#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> ini[100005];
vector<int> mat[100005];
int maior[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int a;
      cin >> a;
      mat[i].push_back(a);
      ini[i].push_back(0);
      maior[i] = 0x3f3f3f3f;
    }
  for (int j = 0; j < m; j++)
    for (int i = 1; i < n; i++) {
      if (mat[i][j] >= mat[i - 1][j]) {
        ini[i][j] = ini[i - 1][j];
        if (maior[i] > ini[i][j]) maior[i] = ini[i][j];
      } else {
        ini[i][j] = i;
      }
    }
  cin >> k;
  for (int i = 0; i < k; i++) {
    int l, r;
    cin >> l >> r;
    bool flag = false;
    if (maior[r - 1] <= l - 1 or l == r)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
