#include <bits/stdc++.h>
using namespace std;
int const inf = 1e9;
int n, m, l, r, k;
int main() {
  scanf("%d%d", &n, &m);
  int a[n + 100][m + 100], b[n + 100][m + 100];
  for (int i = 0; (int)i < n; ++i) {
    for (int j = 0; (int)j < m; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  int k;
  for (int i = 0; (int)i < m; ++i) {
    k = 1;
    for (int j = 0; (int)j < n; ++j) {
      if (j == 0) {
        b[j][i] = k;
        k++;
      } else {
        if (a[j][i] >= a[j - 1][i])
          b[j][i] = k++;
        else {
          k = 1;
          b[j][i] = k++;
        }
      }
    }
  }
  int p[m + 100];
  for (int i = 0; (int)i < n; ++i) {
    for (int j = 0; (int)j < m; ++j) {
      p[j] = b[i][j];
    }
    sort(p, p + m);
    for (int j = 0; (int)j < m; ++j) {
      b[i][j] = p[j];
    }
  }
  int q;
  scanf("%d", &q);
  int l, r;
  for (int i = 0; (int)i < q; ++i) {
    scanf("%d%d", &l, &r);
    int x = r - l + 1;
    if (b[r - 1][m - 1] >= x) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }
  return 0;
}
