#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  int high[n];
  for (int i = 0; i < n; i++) high[i] = i;
  for (int j = 0; j < m; j++) {
    int i = 0;
    while (i < n) {
      int l = i + 1;
      while (l < n && a[l][j] >= a[l - 1][j]) l++;
      for (int le = i; le < l; le++) high[le] = max(high[le], l);
      i = l;
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int le, ri;
    cin >> le >> ri;
    le--;
    ri--;
    if (high[le] > ri)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
