#CCBCMCHIN0000047. Phân loại giờ có điều kiện (Conditional Time Classification)

Phân loại giờ có điều kiện (Conditional Time Classification)

Conditional Time Classification

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given integers h,mh,m representing hour and minute on a 24-hour clock, print INVALID for an invalid time. Otherwise, print AM when h<12h<12, or PM for h≥12h\ge12.

Input

A line contains integers h,mh,m.

Output

Print exactly one of INVALID, AM, or PM.

Subtasks

  • Subtask 1 (20 points): Both values are in [-1,23].

  • Subtask 2 (30 points): Both values are in [-1,59].

  • Subtask 3 (50 points): Both values are in [-1,60].

Examples

Example 1

Input

12 0

Output

PM

Explanation

For this input, the case-specific computation and the required exact output are shown above. 12:00 is a valid time in the PM interval.

Example 2

Input

24 0

Output

INVALID

Explanation

For this input, the case-specific computation and the required exact output are shown above. Hour 24 is outside the allowed range 0–23.