#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n * m];
  int carr[n * m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[m * i + j];
    }
  }
  for (int j = 0; j < m; j++) {
    carr[m * 0 + j] = 0;
    for (int i = 1; i < n; i++) {
      if (arr[m * (i - 1) + j] > arr[m * i + j]) {
        carr[m * i + j] = i;
      } else {
        carr[m * i + j] = carr[m * (i - 1) + j];
      }
    }
  }
  for (int i = 1; i < n; i++) {
    int min = 0;
    for (int j = 1; j < m; j++) {
      if (carr[m * i + min] > carr[m * i + j]) min = j;
    }
    carr[m * i + 0] = carr[m * i + min];
  }
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    if (carr[m * r + 0] <= l) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
