#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector>>road(N); vectorcnt(N); for(int i = 0; i < N; i++) { int A,B; cin >> A >> B; A--; B--; road[A].push_back({B,i+1}); road[B].push_back({A,-i-1}); cnt[A]++; cnt[B]++; } queueque; for(int i = 0; i < N; i++) { if(cnt[i] == 1) { que.push(i); } } vectorf(N); while(!que.empty()) { int x = que.front(); que.pop(); for(auto i:road[x]) { cnt[i.first]--; if(cnt[i.first] != 0) { if(i.second < 0) { f[-i.second-1] = 1; } if(cnt[i.first] == 1) { que.push(i.first); } } } } for(int i = 0; i < N; i++) { if(cnt[i] == 2) { que.push(i); while(!que.empty()) { int x = que.front(); que.pop(); cnt[x] = 0; for(auto j:road[x]) { if(cnt[j.first] == 2) { que.push(j.first); if(j.second < 0) { f[-j.second-1] = 1; } } if(j.first == i) { if(j.second < 0) { f[-j.second-1] = 1; } } } } } } for(int i = 0; i < N; i++) { if(f[i]) { cout << "<-" << "\n"; } else { cout << "->" << "\n"; } } }