#include <bits/stdc++.h>
using namespace std;
long long arr[100100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > vec(n, vector<int>(m));
  vector<vector<int> > last(n, vector<int>(m));
  set<int> ans[n];
  for (auto i = 0; i < (long long)(n); i++) {
    for (auto j = 0; j < (long long)(m); j++) {
      cin >> vec[i][j];
      last[i][j] = i + 1;
      if (i) {
        if (vec[i][j] >= vec[i - 1][j]) {
          last[i][j] = last[i - 1][j];
        }
      }
      ans[i].insert(last[i][j]);
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if ((*ans[r - 1].begin()) > l)
      cout << "No\n";
    else
      cout << "Yes\n";
  }
  return 0;
}
