#include <bits/stdc++.h>
using namespace std;
vector<int> a[100100];
int ans[100100], tmp[100100];
int main() {
  int n, m, k;
  scanf("%d%d", &n, &m);
  memset(ans, 0x3f, sizeof(ans));
  for (int i = 1; i <= n; i++) {
    a[i].push_back(0);
    for (int j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      a[i].push_back(x);
    }
  }
  for (int j = 1; j <= m; j++) {
    int first = 1;
    tmp[1] = 1;
    for (int i = 2; i <= n; i++) {
      if (a[i][j] < a[i - 1][j]) first = i;
      tmp[i] = first;
    }
    for (int i = 1; i <= n; i++) ans[i] = min(ans[i], tmp[i]);
  }
  scanf("%d", &k);
  while (k--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (ans[r] <= l)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
