#include <bits/stdc++.h>
using namespace std;
long long i, j, n, m, b[1000005], k, l, r;
vector<pair<long long, long long> > v;
pair<long long, long long> p;
int main() {
  cin >> n >> m;
  long long a[n + 5][m + 5], dp[n + 5][m + 5];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) {
      if (a[i][j] >= a[i - 1][j])
        dp[i][j] = dp[i - 1][j] + 1;
      else
        dp[i][j] = 1;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      b[i] = max(b[i], dp[i][j]);
    }
  }
  cin >> k;
  for (i = 1; i <= k; i++) {
    cin >> l >> r;
    if (r - l + 1 == 1) {
      cout << "Yes" << endl;
    } else {
      if (b[r] >= r - l + 1) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
  return 0;
}
