#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> a;
map<int, int> l;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) l[i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> a[make_pair(i, j)];
    }
  for (int j = 1; j <= m; j++) {
    int fi = 1;
    for (int i = 1; i <= n; i++) {
      if (a[make_pair(i, j)] > a[make_pair(i + 1, j)]) {
        l[fi] = max(l[fi], i - fi + 1);
        fi = i + 1;
      }
    }
  }
  for (int i = 2; i <= n; i++) l[i] = max(l[i], l[i - 1] - 1);
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    cout << (l[x] >= y - x + 1 ? "Yes" : "No") << endl;
  }
  return 0;
}
