#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[100000], b[100001] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int id = i * m + j;
      cin >> a[id];
    }
  }
  for (int j = 0; j < m; j++) {
    int t = n;
    for (int i = n - 1; i >= 0; i--) {
      int id = i * m + j;
      if (id - m >= 0 && a[id] < a[id - m]) {
        a[id] = t;
        t = i;
      } else
        a[id] = t;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int id = i * m + j;
      b[i + 1] = max(b[i + 1], a[id]);
    }
  }
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int l, r;
    cin >> l >> r;
    if (b[l] >= r)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
