#include #include #include #include #include #include #include using namespace std; #define int long long #define endl "\n" const long long INF = (long long)1e18; const long long MOD = 1'000'000'007; string yn(bool f){return f?"Yes":"No";} string YN(bool f){return f?"YES":"NO";} const int MAX = 310000; int hoge[MAX]; int fuga[MAX]; int temp[MAX]; int print(int x, int y){ for(int i = 0; i < x; i++, y = !y){ cout< ans, ans1, ans0; cin>>N; for(int i = 1; i < MAX; i++){ hoge[i] = INF; } for(int i = 1; i*i <= N; i++){ for(int j = 0; j <= N; j++){// cout< "< i){ fuga[j+i*i] = j; temp[j+i*i] = i; } else { } } else { if(temp[j+i*i]%2){ fuga[j+i*i] = j; temp[j+i*i] = i; } else if(temp[j+i*i] < i){ fuga[j+i*i] = j; temp[j+i*i] = i; } } } } } } for(int i = N;; i = fuga[i]){ if(i){ if(temp[i]%2) ans1.push_back(temp[i]); else ans0.push_back(temp[i]); } if(!i) break; } int now = 0; sort(ans1.begin(), ans1.end()); sort(ans0.begin(), ans0.end(), greater()); for(int i = 0, j = 0, k = 0; i < ans1.size(); i++){ ans.push_back(ans1[i]); } for(int i = 0, j = 0, k = 0; i < ans0.size(); i++){ ans.push_back(ans0[i]); } for(int i = 0, now = 0; ans.size(); i++){ if(!now){ now = print(ans.front(),now); ans.pop_front(); } else { now = print(ans.back(),now); ans.pop_back(); } } cout<