#include <bits/stdc++.h>
using namespace std;
long long a[1000100];
long long ans[1001010];
long long vis[1001010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) scanf("%lld", &a[i * m + j]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i * m + j] >= a[(i - 1) * m + j])
        vis[i * m + j] = vis[(i - 1) * m + j] + 1;
      else
        vis[i * m + j] = 1;
    }
  }
  long long now = 0;
  for (int i = n; i >= 1; i--) {
    if (now) now--;
    for (int j = 1; j <= m; j++) now = max(now, vis[i * m + j]);
    ans[i] = now;
  }
  int k;
  cin >> k;
  while (k--) {
    int l, r;
    cin >> l >> r;
    if (ans[r] >= r - l + 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
