#define _USE_MATH_DEFINES #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 1000000007; // constexpr int MOD = 998244353; constexpr int DY[]{1, 0, -1, 0}, DX[]{0, -1, 0, 1}; constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1}, DX8[]{0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << fixed << setprecision(20); } } iosetup; struct BipartiteMatching { std::vector match; BipartiteMatching(const int n) : n(n), match(n, -1), graph(n), is_used(n, 0), is_alive(n, true) {} void add_edge(const int u, const int v) { graph[u].emplace_back(v); graph[v].emplace_back(u); } int solve() { int res = 0; for (int i = 0; i < n; ++i) { if (is_alive[i] && match[i] == -1) { ++t; res += dfs(i); } } return res; } void fix(const int ver) { is_alive[ver] = false; if (match[ver] != -1) { is_alive[match[ver]] = false; } } int enable(const int ver) { if (is_alive[ver]) return 0; is_alive[ver] = true; ++t; return dfs(ver) ? 1 : 0; } int disable(const int ver) { if (!is_alive[ver]) return 0; is_alive[ver] = false; if (match[ver] == -1) return 0; match[match[ver]] = -1; const int m = match[ver]; match[ver] = -1; ++t; return dfs(m) ? 0 : -1; } void no1744(int u_, int v_) { u = u_; v = v_; } private: const int n; int t = 0; std::vector> graph; std::vector is_used, is_alive; int u = -1, v = -1; bool dfs(const int ver) { is_used[ver] = t; for (const int e : graph[ver]) { if (!is_alive[e] || (ver == u && e == v) || (ver == v && e == u)) continue; const int m = match[e]; if (m == -1 || (is_used[m] < t && dfs(m))) { match[ver] = e; match[e] = ver; return true; } } return false; } }; int main() { int n, m, l; cin >> n >> m >> l; vector s(l), t(l); REP(i, l) cin >> s[i] >> t[i], --s[i], --t[i]; map, int> st; REP(i, l) st[{s[i], t[i]}] = i; BipartiteMatching bm(n + m); REP(i, l) bm.add_edge(s[i], t[i] + n); bm.solve(); vector ans(l, true); REP(i, l) { if (bm.match[i] != -1) ans[st[{i, bm.match[i] - n}]] = false; } REP(i, l) { if (ans[i]) continue; bm.no1744(s[i], n + t[i]); ans[i] = bm.disable(s[i]) == 0 || bm.enable(s[i]) == 1; bm.no1744(-1, -1); bm.disable(s[i]); bm.enable(s[i]); } REP(i, l) cout << (ans[i] ? "Yes\n" : "No\n"); return 0; }