#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const long long lim = (long long)1e14 + 1;
int n, m;
int q;
int l, r;
vector<int> col[N];
vector<int> RangesCovered[N];
void update(int l, int r) {
  for (int st = l; st <= r; ++st) {
    RangesCovered[st].push_back(r);
  }
}
bool possible(int l, int r) {
  if (!RangesCovered[l].size()) {
    return 0;
  }
  return RangesCovered[l][(int)RangesCovered[l].size() - 1] >= r;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      int x;
      cin >> x;
      col[j].push_back(x);
    }
  }
  for (int i = 1; i <= m; ++i) {
    int l = 0, r = 0, prev = col[i][0];
    for (int j = 1; j < n; ++j) {
      if (col[i][j] >= prev) {
        prev = col[i][j];
        r = j;
      } else {
        update(l, r);
        l = r = j;
        prev = col[i][j];
      }
    }
    update(l, r);
  }
  for (int i = 0; i < N; ++i) {
    sort(RangesCovered[i].begin(), RangesCovered[i].end());
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d", &l, &r);
    bool ans = possible(l - 1, r - 1);
    if (ans)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
