#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  const int MAX = 2000;
  auto matrix = vector<bitset<2 * MAX>>(n);
  struct Edge {
    int a, b;
  };
  auto edges = vector<Edge>();
  for (auto i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    matrix[a - 1][b - 1] = true;
    edges.push_back({a - 1, b - 1});
  }
  for (auto i = 0; i < n; i++) matrix[i][MAX + i] = true;
  for (auto pivot = 0; pivot < n; pivot++) {
    for (auto i = pivot; i < n; i++)
      if (matrix[i][pivot]) swap(matrix[i], matrix[pivot]);
    for (auto i = 0; i < n; i++)
      if (i != pivot && matrix[i][pivot]) matrix[i] ^= matrix[pivot];
  }
  for (const auto e : edges)
    cout << (matrix[e.b][MAX + e.a] ? "NO" : "YES") << "\n";
}
