#include using namespace std; int n,d; int a[13]; int b[13]; int c[13]; int dp[1<<13][3]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> d; for(int i=0;i> a[i] >> b[i] >> c[i]; } for(int i=0;i<(1< A) { dp[ni][0] = A; dp[ni][1] = B; dp[ni][2] = C; } else if(dp[ni][0]==A && dp[ni][1] > B) { dp[ni][0] = A; dp[ni][1] = B; dp[ni][2] = C; } else if(dp[ni][0]==A && dp[ni][1]==B && dp[ni][2] > C) { dp[ni][0] = A; dp[ni][1] = B; dp[ni][2] = C; } } } } if(dp[(1<