#include #include #include #include #include using namespace std; typedef pair ii; typedef vector VI; typedef vector VVI; bool FindMatch(int i, const VVI &w, VI &mr, VI &mc, VI &seen) { for (int j = 0; j < w[i].size(); j++) { if (w[i][j] && !seen[j]) { seen[j] = true; if (mc[j] < 0 || FindMatch(mc[j], w, mr, mc, seen)) { mr[i] = j; mc[j] = i; return true; } } } return false; } int BipartiteMatching(const VVI &w, VI &mr, VI &mc) { mr = VI(w.size(), -1); mc = VI(w[0].size(), -1); int ct = 0; for (int i = 0; i < w.size(); i++) { VI seen(w[0].size()); if (FindMatch(i, w, mr, mc, seen)) ct++; } return ct; } int main(int argc, const char * argv[]) { int n; cin>>n; VVI f; for(int ctr1=0;ctr1<50;ctr1++){ VI t(50,0); f.push_back(t); } for(int ctr1=0;ctr1>a; f[ctr1][a]=0; } VI rez,rez2; int r=BipartiteMatching(f, rez, rez2); if(r!=n){ cout<<-1; } else{ for(int ctr1=0;ctr1