#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int to[N];
vector<vector<int> > a;
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    a.push_back({});
    for (int j = 1; j <= m; j++) {
      int num;
      cin >> num;
      a[a.size() - 1].push_back(num);
    }
  }
  for (int col = 0; col < m; col++) {
    int l = 0, r = 1;
    while (r <= n - 1) {
      int tmp = l;
      while (r <= n - 1 && a[tmp][col] <= a[r][col]) {
        tmp++, r++;
      }
      if (r - l == 1 && a[l][col] > a[r][col]) {
        l++, r++;
        continue;
      }
      auto it = mp.find(l);
      if (it == mp.end())
        mp.insert({l, r - 1});
      else
        it->second = max(it->second, r - 1);
      l = r - 1;
    }
  }
  to[0] = 0;
  if (mp.find(0) != mp.end()) to[0] = max(to[0], mp[0]);
  for (int i = 1; i < n; i++) {
    to[i] = max(i, to[i - 1]);
    auto it = mp.find(i);
    if (it != mp.end()) to[i] = max(to[i], it->second);
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    r--, l--;
    if (l == r || to[l] >= r)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
