#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > a, p;
int n, m;
vector<int> best;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    a[i].resize(m);
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  p.resize(n);
  for (int i = 0; i < n; i++) p[i].resize(m);
  for (int j = 0; j < m; j++) {
    p[n - 1][j] = 1;
    for (int i = n - 2; i >= 0; i--)
      if (a[i][j] <= a[i + 1][j])
        p[i][j] = p[i + 1][j] + 1;
      else
        p[i][j] = 1;
  }
  for (int i = 0; i < n; i++) {
    int curr_max = 0;
    for (int j = 0; j < m; j++) curr_max = max(curr_max, p[i][j]);
    best.push_back(curr_max);
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    if (best[l] >= r - l + 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
