#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100009;
int m, n, b[MAXN], s[MAXN], a[MAXN], x, T, l, r;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> x;
      if (x >= a[j])
        s[j]++;
      else
        s[j] = 1;
      a[j] = x;
      b[i] = max(b[i], s[j]);
    }
  cin >> T;
  while (T--) {
    cin >> l >> r;
    if (b[r] >= r - l + 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
