#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define F first
#define S second
#define FIO ios_base::sync_with_stdio(false); cin.tie(0)
#define sz(x) ((int)((x).size()))
#define all(x) x.begin(), x.end()
#define pb push_back
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e6 + 10;
bool cmp(int a, int b) {
if (a == b) return 0;
cout << "cmp " << a << " " << b << endl;
int x;
cin >> x;
return x == 1;
}
void rev(int a, int b) {
if (a == b) return;
cout << "reverse " << a << " " << b << endl;
}
int na, nb;
int main() {
FIO;
cin >> na >> nb;
int tar = na;
for (int l = 1; l <= tar; l++) {
if (tar + 1 == na + nb + 1) break;
if (cmp(l, tar + 1)) {
rev(l, tar + 1);
rev(l + 1, tar + 1);
tar++;
}
}
cout << "end" << endl;
return 0;
}