#include using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define rep1(i,n) for(int i=1; i<=(n); i++) #define sz(x) int(x.size()) #define all(x) (x).begin(),(x).end() #define Q2 1000000007 #define Q 998244353 #define lINF LONG_LONG_MAX //ll #define iINF INT_MAX //int #define yes "Yes" #define no "No" #define kotae cout<; using pqg=priority_queue,greater>; using vi=vector; using vi2=vector>; using vi3=vector>>; using vl=vector; using vl2=vector>; using vl3=vector>>; using vs=vector; using vp=vector

; using vp2=vector>; void chmax(int &x, int y){ x=max(x,y); return; } void chmin(int &x, int y){ x=min(x,y); return; } void chmaxl(ll &x, ll y){ x=max(x,y); return; } void chminl(ll &x, ll y){ x=min(x,y); return; } int main() { int n; cin >> n; vi a(n),b(n); rep(i,n) cin >> a[i] >> b[i]; int s=1<(n)); rep(i,s){ rep(j,n){ if(!((i>>j)&1)) continue; rep(k,n){ // from j to k if((i>>k)&1) continue; chmax(dp[i+(1<