#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; typedef long long ll; const int N = 31; int a[N][N]; int sel[N], vis[N], n, nsel[N]; ll ans = 0; void dfs(int st, ll cur) { if (st == n) { ans = max(ans, cur); return; } for (int i = 0; i < n + n; i++) if (!vis[i]) { vis[i] = 1; sel[st] = i; ll nxt = cur; dfs(st + 1, nxt); vis[i] = 0; } } int main() { scanf("%d", &n); for (int i = 0; i < n + n; i++) for (int j = 0; j < n + n; j++) scanf("%d", &a[i][j]); dfs(0, 0); printf("%lld", ans); return 0; }