#include <bits/stdc++.h>
using namespace std;
class CAlyonaAndSpreadsheet {
 public:
  static void solve(istream& in, ostream& out) {
    int n, m;
    in >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        in >> a[i][j];
      }
    }
    vector<int> mx(n);
    for (int j = 0; j < m; ++j) {
      int pre = 0;
      for (int i = 0; i + 1 < n; ++i) {
        if (a[i][j] > a[i + 1][j]) {
          mx[pre] = max(mx[pre], i);
          pre = i + 1;
        }
      }
      mx[pre] = max(mx[pre], n - 1);
    }
    for (int i = 1; i < n; ++i) {
      mx[i] = max(mx[i], mx[i - 1]);
    }
    int k;
    in >> k;
    for (int i = 0; i < k; ++i) {
      int l, r;
      in >> l >> r;
      --l;
      --r;
      out << (mx[l] >= r ? "Yes" : "No") << '\n';
    }
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  CAlyonaAndSpreadsheet::solve(in, out);
  return 0;
}
