#include <bits/stdc++.h>
using namespace std;
vector<int> a[100010], dp[100010];
int len[100010];
int main() {
  int n, m, i, j, k, l, r;
  while (~scanf("%d%d", &n, &m)) {
    for (i = 1; i <= n; i++) {
      a[i].resize(m + 1);
      for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
    }
    memset(len, 0, sizeof(len));
    for (i = 1; i <= n; i++) {
      dp[i].resize(m + 1);
      if (i == 1)
        for (j = 1; j <= m; j++) dp[i][j] = 1;
      else
        for (j = 1; j <= m; j++)
          if (a[i][j] >= a[i - 1][j])
            dp[i][j] = dp[i - 1][j] + 1;
          else
            dp[i][j] = 1;
      for (j = 1; j <= m; j++) len[i] = max(len[i], dp[i][j]);
    }
    scanf("%d", &k);
    while (k--) {
      scanf("%d%d", &l, &r);
      if (len[r] >= r - l + 1)
        printf("Yes\n");
      else
        printf("No\n");
    }
  }
  return 0;
}
