Company: Flipkart_9nov
Difficulty: medium
Basket Ball Arrangement Problem Description On an Annual Sports Day a game is organised. b boxes are placed in a row from left to right and p balls have to be distributed among them. Reading the number of balls in the boxes from left to right gives a string of b digits, so each box may hold at most 9 balls. The balls have to be arranged in two different ways: W1 - the arrangement whose b -digit number is as large as possible. W2 - the arrangement whose b -digit number is as small as possible. To keep the number b digits long, the first box must hold at least one ball whenever any ball is placed at all. If p is larger than the total capacity b * 9 , only b * 9 balls are used; otherwise all p balls are used. Boxes other than the first may stay empty. Print the two arrangements. Input Format A single line with two space-separated integers: b , the number of boxes, and p , the number of balls. Output Format Two lines. The first line is the W1 arrangement, the second is the W2 arrangement.