#include "scales.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
void init(int T) {
/* ... */
}
// int getHeaviest(int a, int b, int c){
// cout << "H: " << a << " " << b << " "<< c << endl << flush;
// int x;
// cin >> x;
// return x;
// }
// int getMedian(int a, int b, int c){
// cout << "M: " << a << " " << b << " "<< c << endl << flush;
// int x;
// cin >> x;
// return x;
// }
// int getLightest(int a, int b, int c){
// cout << "L: " << a << " " << b << " "<< c << endl << flush;
// int x;
// cin >> x;
// return x;
// }
// void answer(int w[]){
// for(int i = 0;i<6;i++) cout << w[i] << " ";
// return ;
// }
void orderCoins() {
vector<int> a, b;
a.pb(getLightest(1, 2, 3));
a.pb(getMedian(1, 2, 3));
a.pb(getHeaviest(1, 2, 3));
b.pb(getLightest(4, 5, 6));
b.pb(getMedian(4, 5, 6));
b.pb(getHeaviest(4, 5, 6));
vector<int> s;
while(min(sz(a), sz(b))>=1&&sz(a)+sz(b)>=3) {
if(sz(a)<sz(b)) swap(a, b);
auto it=getLightest(a[0], a[1], b[0]);
s.pb(it);
if(find(all(a), it)!=a.end()) a.erase(find(all(a), it));
if(find(all(b), it)!=b.end()) b.erase(find(all(b), it));
}
// cout << "here: ";
// for(auto i : s) cout << i << " ";
// cout << endl;
if(sz(a)&&sz(b)) {
auto it=getMedian(a[0], b[0], s.back());
s.pb(it);
if(find(all(a), it)!=a.end()) a.erase(find(all(a), it));
if(find(all(b), it)!=b.end()) b.erase(find(all(b), it));
}
reverse(all(a));
reverse(all(b));
while(sz(a)) s.pb(a.back()), a.pop_back();
while(sz(b)) s.pb(b.back()), b.pop_back();
int w[6];
for(int i = 0;i < 6;i++) w[i]=s[i];
answer(w);
}
// int main(){
// orderCoins();
// }