#include <bits/stdc++.h>
using namespace std;
struct Solution {
  void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<int64_t>> v(n, vector<int64_t>(m));
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cin >> v[i][j];
      }
    }
    vector<pair<int, int>> q;
    for (int j = 0; j < m; ++j) {
      int st = 0;
      for (int i = 1; i < n; ++i) {
        if (v[i][j] < v[i - 1][j]) {
          q.push_back(make_pair(st, i - 1));
          st = i;
        }
      }
      q.push_back(make_pair(st, n - 1));
    }
    int k;
    cin >> k;
    vector<vector<pair<int, int>>> w(n);
    for (int i = 0; i < k; ++i) {
      int l, r;
      cin >> l >> r;
      --l, --r;
      w[l].push_back(make_pair(r, i));
    }
    vector<vector<pair<int, int>>> x(n), y(n);
    for (int i = 0; i < q.size(); ++i) {
      x[q[i].first].push_back(make_pair(i, q[i].second));
      y[q[i].second].push_back(make_pair(i, q[i].second));
    }
    set<pair<int, int>> h;
    multiset<int> c;
    vector<bool> ans(k);
    for (int i = 0; i < n; ++i) {
      for (auto& t : x[i]) {
        h.insert(t);
        c.insert(t.second);
      }
      for (auto& t : w[i]) {
        int r = t.first;
        if (c.lower_bound(r) != c.end()) {
          ans[t.second] = true;
        }
      }
      for (auto& t : y[i]) {
        h.erase(t);
        c.erase(c.find(t.second));
      }
    }
    for (int i = 0; i < k; ++i) {
      if (ans[i])
        cout << "Yes";
      else
        cout << "No";
      cout << endl;
    }
  }
};
int main(void) {
  ios_base::sync_with_stdio(false);
  Solution().solve();
  return 0;
}
