#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m, k;
vector<int> a[maxn];
int ck[maxn];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    a[i].resize(m + 1, 0);
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  memset(ck, 127 / 3, sizeof(ck));
  for (int j = 1; j <= m; j++) {
    int ls = 1;
    ck[1] = 1;
    for (int i = 2; i <= n; i++) {
      if (a[i][j] < a[i - 1][j]) ls = i;
      ck[i] = min(ck[i], ls);
    }
  }
  cin >> k;
  for (int i = 1; i <= k; i++) {
    int l, r;
    cin >> l >> r;
    if (ck[r] <= l)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
