#include <bits/stdc++.h>
using namespace std;
unsigned long long int expo_fast(long long int a, long long int b) {
  a = a;
  long long int result = 1;
  while (b) {
    if (b & 1) result = (result * a);
    b >>= 1;
    a = (a * a);
  }
  return (result);
}
void take_in(vector<long long int> *arr) {
  for (int i = 0; i < arr->size(); i++) cin >> (*(arr))[i];
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
unsigned long long int power(long long int x, unsigned long long int y,
                             long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<long long int>> arr(n + 1, vector<long long int>(m + 1)),
      cmp(n + 1, vector<long long int>(m + 1));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> arr[i][j];
    }
  }
  for (int j = 1; j <= m; j++) {
    int iter = 1;
    for (int i = 1; i <= n; i++) {
      if (i == 1)
        cmp[i][j] = iter;
      else {
        if (arr[i][j] < arr[i - 1][j]) iter++;
        cmp[i][j] = iter;
      }
    }
  }
  vector<pair<int, int>> range;
  int p1 = 1, p2 = 1, to_x = p1, to_y = p2;
  bool chng = true;
  while (p1 <= n && p2 <= n) {
    bool done = false;
    for (int j = 1; j <= m; j++) {
      if (cmp[p1][j] == cmp[p2][j]) {
        done = true;
        break;
      }
    }
    if (done) {
      to_x = p1;
      to_y = p2;
      p2++;
      chng = true;
    } else {
      if (chng) range.push_back({to_x, to_y});
      chng = false;
      p1++;
      if (p2 < p1) p2 = p1;
    }
  }
  if (chng) range.push_back({to_x, to_y});
  int k;
  cin >> k;
  while (k--) {
    int l, r;
    cin >> l >> r;
    int low = 0, high = range.size() - 1;
    int ans = -1;
    while (low <= high) {
      int mid = (low + high) / 2;
      if (range[mid].first <= l && range[mid].second >= r) {
        ans = 1;
        break;
      } else if (l < range[mid].first)
        high = mid - 1;
      else if (r > range[mid].second)
        low = mid + 1;
    }
    if (ans != -1)
      cout << "Yes";
    else
      cout << "No";
    cout << "\n";
  }
}
