#include <bits/stdc++.h>
const int N = 100005;
using namespace std;
int n, m, val[N], col[N], row[N], t, k, l, r;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    row[i] = i;
    for (int j = 0; j < m; j++) {
      cin >> t;
      if (val[j] > t) col[j] = i;
      val[j] = t;
      row[i] = min(row[i], col[j]);
    }
  }
  cin >> k;
  while (k--) {
    cin >> l >> r;
    cout << (l - 1 >= row[r - 1] ? "Yes\n" : "No\n");
  }
  return 0;
}
