#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int a[maxn], b[maxn], c[maxn];
int main() {
  int n, m;
  int x;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> x;
      if (x >= a[j])
        b[j]++;
      else
        b[j] = 1;
      a[j] = x;
      c[i] = max(c[i], b[j]);
    }
  }
  int T;
  cin >> T;
  while (T--) {
    int l, r;
    cin >> l >> r;
    if (c[r] >= r - l + 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
