#include <bits/stdc++.h>
using namespace std;
int arr[123456], pre[123456], haha[123456];
int main() {
  std::ios::sync_with_stdio(false);
  int n, m, i, j;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> arr[m * i + j];
    }
  }
  for (j = 0; j < m; j++) {
    pre[m * 0 + j] = 0;
    for (i = 1; i < n; i++) {
      if (arr[m * i + j] >= arr[m * (i - 1) + j]) {
        pre[m * i + j] = pre[m * (i - 1) + j];
      } else {
        pre[m * i + j] = i;
      }
    }
  }
  for (i = 0; i < n; i++) {
    haha[i] = pre[m * i + 0];
    for (j = 0; j < m; j++) {
      haha[i] = min(haha[i], pre[m * i + j]);
    }
  }
  int k;
  cin >> k;
  while (k--) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    if (haha[r] <= l) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
