#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> table[100005];
vector<int> dp[100005];
int low[100005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int temp;
      scanf("%d", &temp);
      table[i].push_back(temp);
    }
  }
  for (int i = 0; i < n; i++) dp[i].resize(m + 1);
  for (int j = 0; j < m; j++) {
    for (int i = 1; i < n; i++) {
      if (table[i - 1][j] <= table[i][j])
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    int Min = dp[i][0];
    for (int j = 0; j < m; j++) Min = min(Min, dp[i][j]);
    low[i] = Min;
  }
  scanf("%d", &k);
  int l, r;
  while (k--) {
    scanf("%d%d", &l, &r);
    l--;
    r--;
    if (low[r] <= l)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
