#include <bits/stdc++.h>
using namespace std;
int rr[100005], c[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k, l, r;
  cin >> n >> m;
  int a[n + 5][m + 5];
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int d = i;
      if (c[j] >= i) {
        d = c[j];
      } else {
        while (a[d + 1][j] >= a[d][j]) {
          d++;
        }
      }
      c[j] = d;
      rr[i] = max(rr[i], d);
    }
  }
  cin >> k;
  for (int i = 1; i <= k; i++) {
    cin >> l >> r;
    if (rr[l] >= r) {
      cout << "Yes" << endl;
    } else
      cout << "No" << endl;
  }
  return 0;
}
