#include<cstdio> #include<stack> using namespace std; stack<int> st; int main() { int m, n, k; scanf("%d%d%d", &m, &n, &k); while (k--) { int t = n; int num = 1; bool flag = true; while (t--) { int x; scanf("%d", &x); while(num<=x) st.push(num++); int last = st.top(); if (last != x|| st.size() > m) flag = false; st.pop(); } if (flag) printf("YES\n"); else printf("NO\n"); } return 0; }