#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int** arr = new int*[2];
  int** dp = new int*[2];
  for (int i = 0; i < 2; i++) {
    arr[i] = new int[m + 1];
    dp[i] = new int[m + 1];
  }
  int* result = new int[n + 1];
  for (int i = 1; i <= m; i++) {
    dp[0][i] = INT_MAX;
    arr[0][i] = INT_MAX;
  }
  int x = 1;
  for (int i = 1; i <= n; i++) {
    result[i] = INT_MAX;
    for (int j = 1; j <= m; j++) {
      cin >> arr[x][j];
      if (arr[x][j] >= arr[x ^ 1][j]) {
        dp[x][j] = dp[x ^ 1][j];
      } else {
        dp[x][j] = i;
      }
      result[i] = min(dp[x][j], result[i]);
    }
    x = x ^ 1;
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (result[r] <= l)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
