#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 520;
long long A[N];
long long dp[N];
long long maxl[N];
long long n, m;
long long get(long long x, long long y) {
  if (x == 0) return N - 1;
  return (x - 1) * m + y;
}
int main() {
  cin >> n >> m;
  A[N - 1] = 0;
  for (long long i = 1; i <= n * m; i++) cin >> A[i];
  for (long long i = 1; i <= m; i++)
    for (long long j = 1; j <= n; j++) {
      if (j == 1) {
        long long a = get(j, i);
        dp[a] = 1;
        maxl[j] = max(maxl[j], 1ll);
        continue;
      }
      long long a = get(j, i);
      long long b = get(j - 1, i);
      long long xia = A[a];
      long long shang = A[b];
      if (xia >= shang) {
        dp[a] = dp[b] + 1;
        maxl[j] = max(maxl[j], dp[a]);
      } else {
        dp[a] = 1;
        maxl[j] = max(maxl[j], dp[a]);
      }
    }
  long long t;
  cin >> t;
  while (t--) {
    long long l, r;
    cin >> l >> r;
    if (r - maxl[r] + 1 <= l) {
      cout << "Yes" << endl;
      continue;
    }
    cout << "No" << endl;
  }
}
