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