#pragma GCC optimize("Ofast") #include using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(x) (x).begin(),(x).end() constexpr char ln = '\n'; constexpr long long MOD = 1000000007LL; //constexpr long long MOD = 998244353LL; template inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; } template inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ll dp[1<<16][16][3]; //A*B 1, B*C 2, C*A 3 int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector A(N),B(N),C(N); rep(i,N) cin >> A[i] >> B[i] >> C[i]; rep(mask,1<