#include <bits/stdc++.h>
using namespace std;
struct Task {
  int n, m, q;
  vector<vector<int>> a;
  vector<vector<pair<int, int>>> que;
  Task(int n, int m) : n(n), m(m), a(n), que(n) {
    for (auto& item : a) {
      item.resize(m);
      for (auto& element : item) {
        cin >> element;
      }
    }
    cin >> q;
    for (int i = 0; i < q; ++i) {
      int l, r;
      cin >> l >> r;
      --l;
      --r;
      que[l].emplace_back(r, i);
    }
  }
  void run() {
    vector<vector<int>> g(n);
    for (int j = 0; j < m; ++j) {
      for (int i = 0; i < n; ++i) {
        int it = i + 1;
        while (it < n && a[it][j] >= a[it - 1][j]) {
          ++it;
        }
        --it;
        g[i].push_back(it);
        i = it;
      }
    }
    vector<int> result(q);
    int mx = 0;
    for (int i = 0; i < n; ++i) {
      for (auto& r : g[i]) {
        mx = max(mx, r);
      }
      for (auto& item : que[i]) {
        int r = item.first;
        int id = item.second;
        result[id] = r <= mx;
      }
    }
    for (auto& item : result) {
      cout << (item ? "Yes" : "No") << '\n';
    }
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  Task a(n, m);
  a.run();
  return 0;
}
