#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int dp[maxn];
int *a[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    a[i] = new int[m + 5];
    for (int j = 0; j < m; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; ++i) dp[i] = i;
  for (int j = 0; j < m; ++j) {
    int cur = 0;
    for (int i = 1; i < n; ++i) {
      if (a[i][j] < a[i - 1][j]) {
        dp[i] = min(cur + 1, dp[i]);
        cur = i;
      }
    }
    dp[n] = min(cur + 1, dp[n]);
  }
  int MIN = dp[n];
  for (int i = n - 1; i >= 1; --i) {
    MIN = dp[i] = min(dp[i], MIN);
  }
  int k;
  scanf("%d", &k);
  while (k--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (dp[r] <= l) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }
}
