#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> v[N];
int maxx[N], n, m, k;
int main() {
  for (int i = 0; i < N; ++i) maxx[i] = -1;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    v[i].resize(m);
    for (int j = 0; j < m; ++j) scanf("%d", &v[i][j]);
  }
  int l, r;
  for (int j = 0; j < m; ++j) {
    l = 0, r = 0;
    for (int i = 1; i < n; ++i) {
      if (v[i][j] >= v[i - 1][j])
        r = i;
      else {
        maxx[l] = max(maxx[l], r);
        l = r = i;
      }
    }
    maxx[l] = max(maxx[l], r);
  }
  for (int i = 1; i < n; ++i) maxx[i] = max(maxx[i], maxx[i - 1]);
  cin >> k;
  while (k--) {
    scanf("%d%d", &l, &r);
    l--, r--;
    if (maxx[l] >= r)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
