#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<vector<long long>> v(n, vector<long long>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> v[i][j];
  }
  vector<vector<long long>> ans(n, vector<long long>(m));
  for (int j = 0; j < m; j++) {
    ans[0][j] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      ans[i][j] = ans[i - 1][j];
      if (v[i][j] >= v[i - 1][j]) ans[i][j]++;
    }
  }
  int k;
  cin >> k;
  map<pair<int, int>, int> map;
  while (k--) {
    int l, r;
    cin >> l >> r;
    if (map.find(make_pair(l, r)) != map.end()) {
      if (map[make_pair(l, r)] == 1)
        cout << "Yes\n";
      else
        cout << "No\n";
    } else {
      int flag = 0;
      for (int j = 0; j < m; j++) {
        int count = ans[r - 1][j] - ans[l - 1][j];
        if (count == r - l) {
          flag = 1;
          break;
        }
      }
      if (flag) {
        cout << "Yes\n";
        map[make_pair(l, r)] = 1;
      } else {
        cout << "No\n";
        map[make_pair(l, r)] = 0;
      }
    }
  }
}
