#include <bits/stdc++.h>
int main() {
  int a[100020], b[100020], c[100020];
  int n, m, x;
  int k, l, r;
  int i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    c[i] = i;
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      if (x < a[j]) b[j] = i;
      a[j] = x;
      if (b[j] < c[i]) c[i] = b[j];
    }
  }
  scanf("%d", &k);
  while (k--) {
    scanf("%d%d", &l, &r);
    if (c[r] <= l)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
