#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int INF = 1e9;
int n, m, l, r, k;
vector<vector<int>> a;
vector<vector<int>> b;
void process() {
  b.resize(n, vector<int>(m, 0));
  for (int j = 0; j < m; j++) b[n - 1][j] = 1;
  for (int i = n - 2; i >= 0; i--)
    for (int j = 0; j < m; j++)
      if (a[i][j] <= a[i + 1][j])
        b[i][j] = b[i + 1][j] + 1;
      else
        b[i][j] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) b[i][0] = max(b[i][0], b[i][j]);
}
bool check() { return (b[l][0] + l > r); }
int main() {
  cin >> n >> m;
  a.resize(n, vector<int>(m, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  process();
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> l >> r;
    l--;
    r--;
    if (check())
      puts("Yes");
    else
      puts("No");
  }
}
