#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 1e9 + 7;
const double pi = 2 * acos(0.0);
const double esp = 1e-9;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int main() {
  int test = 1, n, x, y;
  for (int cs = 1; cs <= test; cs++) {
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
      scanf("%d %d", &x, &y);
    }
    for (int i = 0; i <= n - 2; i++) {
      printf("%d\n", i);
    }
  }
  return 0;
}
