import math


def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA")


if __name__ == '__main__':
    main() import math math def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA") main s = input() s input() input f = int(s[:2]) f int(s[:2]) int s[:2] s :2 2 b = int(s[2:]) b int(s[2:]) int s[2:] s 2: 2 if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA") 1 <= f and f <= 12 and 1 <= b and b <= 12 1 <= f and f <= 12 and 1 <= b 1 <= f and f <= 12 1 <= f 1 f f <= 12 f 12 1 <= b 1 b b <= 12 b 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
     0 <= f and f <= 99 and 1 <= b and b <= 12 0 <= f and f <= 99 and 1 <= b 0 <= f and f <= 99 0 <= f 0 f f <= 99 f 99 1 <= b 1 b b <= 12 b 12 print("YYMM") print "YYMM" elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
     0 <= b and b <= 99 and 1 <= f and f <= 12 0 <= b and b <= 99 and 1 <= f 0 <= b and b <= 99 0 <= b 0 b b <= 99 b 99 1 <= f 1 f f <= 12 f 12 print("MMYY") print "MMYY" print("NA") print "NA" if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA") def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA") main
import math


def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA")


if __name__ == '__main__':
    main()
