#include using namespace std; typedef long long ll; #define P pair #define pub push_back #define pob pop_back #define mp make_pair #define nl '\n' //new line #define mset multiset #define lb lower_bound #define rep(i,n) for(ll i=0;i<(ll)(n);++i) template bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;} template bool chmax(T& a,T b){if(a g[num]; void con(ll x,ll y){ g[x].pub(y); g[y].pub(x); } int main(){ ll x,y; cin>>x>>y; for(int i=1;i<=x;++i){ if(i==x) con(1,i); else con(i,i+1); } for(int i=x+1;i<=x*y;++i){ con(i,i-x); } cout<