import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int x = scan.nextInt(); int[] list = new int[x]; for(int i = 0 ; i < n ; i++){ int a = scan.nextInt()-1; int b = scan.nextInt(); list[a] = b; } int count = 1; while(count > 0){ count = 0; for(int i = 1 ; i < x-1 ; i++){ if(list[i-1] < list[i] -1 || list[i-1] -1 > list[i] ){ count++; if( list[i-1] < list[i] -1 ){ list[i-1] = list[i] - 1; }else if( list[i-1] -1 > list[i] ){ list[i] = list[i-1] -1; } } if(list[i+1] < list[i] -1 || list[i+1] -1 > list[i] ){ count++; if( list[i+1] < list[i] -1 ){ list[i+1] = list[i] - 1; }else if( list[i+1] -1 > list[i] ){ list[i] = list[i+1] -1; } } } } for(int i = 0 ; i < x ; i++){ System.out.print(list[i] + " "); } System.out.println(""); } }