#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, mp[200005], f[200005], a[100005];
int main() {
  scanf("%d%d", &n, &m);
  memset(f, 0, sizeof(f));
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int id = (i - 1) * m + j;
      scanf("%d", &mp[id]);
      if (i > 1 && mp[id] >= mp[id - m])
        f[id] = f[id - m] + 1;
      else
        f[id] = 1;
      a[i] = max(a[i], f[id]);
    }
  }
  scanf("%d", &k);
  while (k--) {
    scanf("%d%d", &x, &y);
    if (y - x + 1 > a[y])
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}
