#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e5 + 5;
set<long long> Left[N];
long long maxFromLeft[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long a[n + 1][m + 1];
  memset(a, 0, sizeof(a));
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> a[i][j];
  long long cur, mx = 0;
  for (long long j = 1; j <= m; j++) {
    cur = 0;
    for (long long i = 1; i <= n; i++) {
      if (a[i][j] >= a[i - 1][j])
        cur++;
      else {
        Left[i - cur].insert(i - 1);
        cur = 1;
      }
    }
    Left[n + 1 - cur].insert(n);
  }
  for (long long i = 1; i <= n; i++) {
    if (!Left[i].empty()) mx = max(mx, *Left[i].rbegin());
    maxFromLeft[i] = mx;
  }
  long long k, l, r;
  cin >> k;
  while (k--) {
    cin >> l >> r;
    if (maxFromLeft[l] >= r)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
