#include <bits/stdc++.h>
#include "scales.h"
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
void init(int T) {
}
map<vi, int> asks;
int queryLight(int a, int b, int c) {
vi v = {a, b, c};
sort(all(v));
if (asks.count(v)) return asks[v];
return asks[v] = getLightest(a, b, c);
}
void orderCoins() {
int w[] = {1, 2, 3, 4, 5, 6};
while (true) {
bool b = false;
for (int i = 0; i < 4; i++) {
int x = queryLight(w[i], w[i + 1], w[i + 2]);
if (x != w[i]) {
b = true;
}
for (int j = i + 1; j < i + 3; j++) {
if (x == w[j]) {
swap(w[i], w[j]);
break;
}
}
}
if (!b) break;
}
int x = getMedian(w[3], w[4], w[5]);
if (x != w[4]) swap(w[4], w[5]);
answer(w);
}
//1
//3 4 6 2 1 5