Олимпиадный тренинг

Задача 37707. Game for Masha


Задача

Темы: Множества
Dasha invites Masha to play the next game. Dasha writes one number on a piece of paper, and Masha's task is to write another number using only the numbers that are in Dasha's number. Write a program that prints the numbers used by Masha to write down her number if Masha fulfilled Dasha's condition, otherwise display the word losing

Input: The input is two natural numbers (first Dasha's number, then Masha's number) not exceeding 109. Each number on a separate line
Output: print in ascending order the required numbers, or the word losing

 

Examples
# Input Output
1 5112648
1246
1 2 4 6
2 64141
1246
losing