Diamonds P75018


Statement
 

pdf   zip

A very rich prince has exactly nn diamonds. Each diamond 1in1 \le i \le n has a certain value viv_i. Tradition says that, before getting married, the prince has to give a present of value exactly VV to his princess. The prince wants to give her exactly two of his diamonds, but he does not know how to decide quickly if he can do it or not. Can you help to this stupid?

For instance, if n=6n=6 and the value of the diamonds is 5,8,6,2,6,205, 8, 6, 2, 6, 20, then it is possible to give a present of value V=10V=10 (8+28+2) or a present of value V=12V=12 (6+66+6), but it is impossible to give a present of value V=9V=9.

Input

Input consists of several cases. Each case begins with the gift value VV (a natural number between 1 and 10810^8) and the number nn of diamonds (a natural number between 1 and 10510^5) in this order. Then come nn natural numbers between 1 and 10810^8 indicating the value of each diamond. A case with V=n=0V = n = 0 marks the end of the input.

Output

For each case, print a line with “married” or “single” depending on whether the prince can give the present or not.

Public test cases
  • Input

    12 6
    5 8 6 2 6 20
    9 6
    5 8 6 2 6 20
    0 0
    

    Output

    married
    single
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++ Python
    User solutions
    C++ Java Python