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