#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
int n, p=1, t, q, x, y;
bool a[13], u[1000][13];
void dfs(int N, int K){
if (N==13 && K<6 || K>6) return;
if (N==13){
fox1(l, 12) u[p][l]=a[l];
++p;
return;
}
a[N]=0;
dfs(N+1, K);
a[N]=1;
dfs(N+1, K+1);
}
int main(){
dfs(1, 1);
cin >> t >> n >> q;
fox(l, q){
cin >> x >> y;
if (t==1){
fox1(l2, 12){
if (u[x][l2] && !u[y][l2]){
cout << l2 << endl;
break;
}
}
}
else {
/*fox1(l2, 12){
cout << u[x][l2] << ' ';
}
cout << endl;*/
if (u[x][y]){
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
}
}
return 0;
}
/*
8
11
8
11
11
8
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
int n, p=1, t, q, x, y;
bool a[13], u[1000][13];
void dfs(int N, int K){
if (N==13 && K<6 || K>6) return;
if (N==13){
fox1(l, 12) u[p][l]=a[l];
++p;
return;
}
a[N]=0;
dfs(N+1, K);
a[N]=1;
dfs(N+1, K+1);
}
int main(){
dfs(1, 1);
cin >> t >> n >> q;
fox(l, q){
cin >> x >> y;
if (t==1){
fox1(l2, 12){
if (u[x][l2] && !u[y][l2]){
cout << l2 << endl;
break;
}
}
}
else {
/*fox1(l2, 12){
cout << u[x][l2] << ' ';
}
cout << endl;*/
if (u[x][y]){
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
}
}
return 0;
}
/*
8
11
8
11
11
8
*/
Compilation message
encoder.cpp: In function 'void dfs(int, int)':
encoder.cpp:30:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (N==13 && K<6 || K>6) return;
^
/tmp/cchWzeoY.o: In function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cchPbRzy.o:encoder.cpp:(.text.startup+0x0): first defined here
/tmp/cchWzeoY.o: In function `main':
grader_encode.c:(.text.startup+0x10a): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status
decoder.cpp: In function 'void dfs(int, int)':
decoder.cpp:30:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (N==13 && K<6 || K>6) return;
^
/tmp/ccdOhAlz.o: In function `main':
grader_decode.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cc5EUqR3.o:decoder.cpp:(.text.startup+0x0): first defined here
/tmp/ccdOhAlz.o: In function `main':
grader_decode.c:(.text.startup+0x19f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status