#include <bits/stdc++.h>
using namespace std;
vector<int> vec[100001];
int n, m;
int ret[100001];
void pre() {
  int msort[n][m];
  memset(msort, 0, sizeof msort);
  for (int j = 0; j < m; ++j) {
    msort[n - 1][j] = 1;
    for (int i = n - 2; i >= 0; i--) {
      if (vec[i][j] > vec[i + 1][j]) {
        msort[i][j] = 1;
      } else {
        msort[i][j] = msort[i + 1][j] + 1;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    ret[i] = 0;
    for (int j = 0; j < m; ++j) ret[i] = max(ret[i], msort[i][j]);
  }
}
int main() {
  int a;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      scanf("%d", &a);
      vec[i].push_back(a);
    }
  }
  pre();
  int k;
  cin >> k;
  int x, y;
  for (int i = 0; i < k; ++i) {
    scanf("%d %d", &x, &y);
    x--;
    y--;
    if (ret[x] >= y - x + 1)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
