Friend numbers

Two numbers are called friends if they are different and the sum of the divisors of each number (including 1, but excluding the own number) is equal to the other number.

For instance, 2620 and 2924 are friends: 2620 is divisible by 1, 2, 4, 5, 10, 20, 131, 262, 524, 655 and 1310; that sum 2924. 2924 is divisible by 1, 2, 4, 17, 34, 43, 68, 86, 172, 731 and 1462; that sum 2620.

Write a program that prints if pairs of numbers are friends.

Input

Input is a sequence of pairs of natural numbers aa, bb with 2a<b2\le a <b.

Output

For each pair aa, bb of the input, print if they are friends or are not according to the format of the example.

Observation

This problem is from “The British Informatics Olympiad for schools and colleges”.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:13:30.664Z

© Jutge.org, 2006–2026.
https://jutge.org