This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0334"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
#include "../graph/bipartite_matching_lexmin.cpp"
int main() {
int n;
scanf("%d", &n); n--;
Bipartite_Matching_LexMin G(n, n);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
int x;
scanf("%d", &x);
if(x){
G.add_edge(j, i);
}
}
}
auto matching = G.solve_LexMin();
if(matching != n) {
puts("no");
return 0;
}
puts("yes");
for (int i = 0; i < n; ++i) {
printf("%d\n", G.match[i]-n+1);
}
return 0;
}
#line 1 "test/aoj0334.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0334"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
#line 1 "graph/bipartite_matching.cpp"
class Bipartite_Matching {
protected:
vector<vector<int>> G;
vector<int> used, alive;
int t;
int l, r;
public:
vector<int> match;
explicit Bipartite_Matching(int l, int r): l(l), r(r), t(0), G(l+r), used(l+r, 0), alive(l+r, -1), match(l+r, -1) {};
void add_edge(int a, int b){
G[a].emplace_back(b+l);
G[b+l].emplace_back(a);
}
bool dfs(int x){
used[x] = t;
for (auto &&i : G[x]) {
int w = match[i];
if(alive[i] == 0) continue;
if(w == -1 || (used[w] != t && dfs(w))){
match[x] = i;
match[i] = x;
return true;
}
}
return false;
}
int matching() {
int ans = 0;
for (int i = 0; i < G.size(); ++i) {
if(alive[i] == 0) continue;
if(match[i] == -1) {
++t;
ans += dfs(i);
}
}
return ans;
}
};
/**
* @brief 二部グラフの最大マッチング
* @docs _md/bipartite_matching.md
*/
#line 2 "graph/bipartite_matching_lexmin.cpp"
class Bipartite_Matching_LexMin : public Bipartite_Matching {
public:
using Bipartite_Matching::Bipartite_Matching;
int solve_LexMin() { // check sorted edge no
int res = matching();
for (int i = 0; i < l; ++i) {
if(!~match[i]) continue;
match[match[i]] = -1;
match[i] = -1;
++t;
dfs(i);
alive[match[i]] = 0;
alive[i] = 0;
}
return res;
}
};
#line 21 "test/aoj0334.test.cpp"
int main() {
int n;
scanf("%d", &n); n--;
Bipartite_Matching_LexMin G(n, n);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
int x;
scanf("%d", &x);
if(x){
G.add_edge(j, i);
}
}
}
auto matching = G.solve_LexMin();
if(matching != n) {
puts("no");
return 0;
}
puts("yes");
for (int i = 0; i < n; ++i) {
printf("%d\n", G.match[i]-n+1);
}
return 0;
}