#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = std::numeric_limits<long long>::max();
const long long TE3 = 1005;
const long long TE5 = 300005;
const string YN[2] = {"No", "Yes"};
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  vector<vector<long long> > a(n, vector<long long>(m));
  for (long long i = (0); i < (n); ++i) {
    for (long long j = (0); j < (m); ++j) {
      cin >> a[i][j];
    }
  }
  vector<vector<long long> > dp(n, vector<long long>(m, 0));
  for (long long c = (0); c < (m); ++c) {
    for (long long r = (1); r < (n); ++r) {
      if (a[r][c] >= a[r - 1][c]) {
        dp[r][c] = 1 + dp[r - 1][c];
      }
    }
  }
  vector<long long> g(n, 0);
  for (long long r = (0); r < (n); ++r) {
    for (long long c = (0); c < (m); ++c) {
      g[r] = max(g[r], dp[r][c]);
    }
  }
  long long k;
  cin >> k;
  while (k--) {
    long long l, r;
    cin >> l >> r;
    --l;
    --r;
    long long ans = (r - g[r]) <= l;
    cout << YN[ans] << endl;
  }
  return 0;
}
