#include using namespace std; using ll=long long; struct card{ ll a,b; card(){} card(ll a,ll b):a(a),b(b){} void print(){ cout< v={15,12,10,7,5,1}; const ll x=500000000000000000; ll solver(int n,vector c){ auto f=[&](int p){ card t=c[p]+c[(p+1)%n]; int index=(p+1)%n; for(int j=2;jmax(abs(tt.a-x),abs(tt.b-x))){ index=(p+j)%n; t=tt; } } c[p]=t; c[index]=t; cout<>n; vector c(n); random_device seed; mt19937 rnd(seed()); for(int i=0;i>a>>b; c[i]=card(a,b); } cout<<50<max(abs(tt.a-x),abs(tt.b-x))){ index=(p+j)%n; t=tt; } } c[p]=t; c[index]=t; cout<