#include <bits/stdc++.h>
using namespace std;
int n, m, k;
template <class T>
inline T read(T &n) {
  n = 0;
  int t = 1;
  double x = 10;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-')
    t = -1;
  else
    n = n * 10 + ch - '0';
  ch = getchar();
  while (ch >= '0' && ch <= '9' && ch != '.') {
    n = n * 10 + ch - '0';
    ch = getchar();
  }
  if (ch == '.') {
    ch = getchar();
    while (ch >= '0' && ch <= '9') {
      n += (ch - '0') / x;
      x *= 10;
    }
  }
  n *= t;
  return n;
}
int main() {
  read(n);
  read(m);
  int a[n + 1][m + 1];
  for (int i = 1; i <= n; i += 1)
    for (int j = 1; j <= m; j += 1) read(a[i][j]);
  int b[n + 1][m + 1];
  for (int i = 1; i <= m; i += 1) b[1][i] = 1;
  for (int i = 2; i <= n; i += 1)
    for (int j = 1; j <= m; j += 1)
      if (a[i - 1][j] <= a[i][j])
        b[i][j] = 1 + b[i - 1][j];
      else
        b[i][j] = 1;
  for (int i = 1; i <= n; i += 1) {
    b[i][0] = 0;
    for (int j = 1; j <= m; j += 1) b[i][0] = max(b[i][0], b[i][j]);
  }
  read(k);
  while (k--) {
    int l, r;
    read(l);
    read(r);
    if (l == r) {
      cout << "Yes" << endl;
      continue;
    }
    if (b[r][0] >= r - l + 1) {
      cout << "Yes" << endl;
      goto Next;
    }
    cout << "No" << endl;
  Next:;
  }
  return 0;
}
