#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> v[N];
int maxi[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, x, k, l, r, cnt;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> x;
      v[j].push_back(x);
    }
  }
  for (int j = 1; j <= m; j++) {
    cnt = 1;
    for (int i = 2; i <= n; i++) {
      if (v[j][i - 1] >= v[j][i - 2])
        cnt++;
      else {
        maxi[i - cnt] = max(cnt, maxi[i - cnt]);
        cnt = 1;
      }
    }
    maxi[n - cnt + 1] = max(maxi[n - cnt + 1], cnt);
  }
  for (int i = 2; i <= n; i++) {
    maxi[i] = max(maxi[i - 1] - 1, maxi[i]);
  }
  cin >> k;
  while (k--) {
    cin >> l >> r;
    if (maxi[l] >= (r - l + 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
