#K45177. Perfect Number and Bart's Chocolate Bars

    ID: 27696 Type: Default 1000ms 256MiB

Perfect Number and Bart's Chocolate Bars

Perfect Number and Bart's Chocolate Bars

A number \( n \) is called a perfect number if it is equal to the sum of its proper divisors (i.e., all divisors excluding \( n \) itself):

\( n = \sum_{d|n,\, d < n} d \)

Bart has a peculiar habit when buying chocolate bars: he will only buy a chocolate bar if its weight is a perfect number. Given a list of chocolate bar weights, determine for each weight whether Bart will buy it. For each weight, output BUY if it is a perfect number, and PASS otherwise.

inputFormat

The input is given via stdin in the following format:

  1. The first line contains a single integer \( N \) representing the number of chocolate bars.
  2. The second line contains \( N \) space-separated integers, each representing the weight of a chocolate bar.

outputFormat

For each chocolate bar weight provided in the input, print a line with either BUY if the weight is a perfect number, or PASS otherwise. The output should be written to stdout.

## sample
4
6 28 12 496
BUY

BUY PASS BUY

</p>