import java.util.*;
 
  
   
    public class Solution{
        
        public static void main(String args[]){
            
            Scanner sc = new Scanner(System.in);
            
            int n = sc.nextInt();
            
            int n1 = n-1;
            
            while(n1 --> 0){
                int u = sc.nextInt();
                int v = sc.nextInt();
            }
            
            n1 = n-1;
            int i = 0;
            while(n1 --> 0){
                System.out.println(i);
                i++;
            }
            
        }
    }