jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}


const judge = (number :number) => {
    const T: { [key: number]: number | undefined } = {};

    for (let x = 1; x * x <= number; x++) {
        for (let y = 1; y * y <= number; y++) {
            for (let z = 1; z * z <= number; z++) {
                const n:number = formula(x, y, z)
                T[n] = (T[n] || 0) + 1;
            }
        }
    }
    return T
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))
    const res:{[key: string]: number | undefined} = judge(data[0])
    const ans:number[] = []
    for (let i :number = 1; i <= data[0]; i++){
        ans.push(res[i] || 0)
    }
    return ans
}

console.log(...main())
//  [typescript]
import * as fs from "fs";

// inputで受け取り配列化する
const input = Number(fs.readFileSync("/dev/stdin", "utf8"));

let num = 1;
while (true) {
  const _num = Math.pow(num, 2) + 1 + 1 + 1 + num + num;
  if (_num > input) {
    break;
  }
  num++;
}

const map = new Map();

for (let x = 1; x <= num; x++) {
  for (let y = 1; y <= num; y++) {
    for (let z = 1; z <= num; z++) {
      const sum =
        Math.pow(x, 2) +
        Math.pow(y, 2) +
        Math.pow(z, 2) +
        x * y +
        y * z +
        x * z;
      if (map.has(sum)) {
        const cnt = map.get(sum);
        map.set(sum, cnt + 1);
      } else {
        map.set(sum, 1);
      }
    }
  }
}

for (let index = 1; index <= input; index++) {
  if (map.has(index)) {
    console.log(map.get(index));
  } else {
    console.log(0);
  }
}
//  [typescript]
import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}


const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=6
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+3) === i){
                counter +=3
            }
            if (formula(j, j+3, j+3) === i){
                counter +=3
            }
            if (formula(j, j+2, j+3) === i){
                counter +=6
            }
            if (formula(j, j, j+3) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())
//  [typescript]
import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}


const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=6
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())
//  [typescript]
import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}


const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=3
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())
//  [python]
a = input()
m = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if a[:2] in m and a[2:] in m:
  print("AMBIGUOUS")
elif a[:2] not in m and a[2:] in m:
  print("YYMM")
elif a[:2] in m and a[2:] not in m:
  print("MMYY")
else:
  print("NA")
//  [python]
S = input()

s = list(S)
num = []
for k in s:
    num.append(int(k))

num1 = 10*num[0] + num[1]

num2 = 10*num[2] + num[3]

ans1 = False
ans2 = False
if num1 < 13 and num1 >0:
    ans1 = True

if num2 < 13 and num2 >0:
    ans2 = True

if ans1 and ans2:
    print("AMBIGUOUS")
elif ans1 and not ans2:
    print("MMYY")
elif not ans1 and ans2:
    print("YYMM")
else:
    print("NA")
//  [python]
s = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")
//  [python]
inp = input()
fst = int(inp[0:2])
snd = int(inp[2:4])

if(fst!=0 and fst>0 and fst<=12 and snd!=0 and snd>0 and snd<=12):
    print("AMBIGUOUS")
else:
    if(fst!=0 and fst>0 and fst>=12 and snd>0 and snd!=0 and snd<=12):
        print("YYMM")
    elif(fst!=0 and fst>0 and snd>0 and fst<=12 and snd!=0 and snd>=12):
        print("MMYY")
    else:
        print("NA")
//  [python]
inp = input()
fst = int(inp[0:2])
snd = int(inp[2:4])

if(fst!=0 and fst<=12 and snd!=0 and snd<=12):
    print("AMBIGUOUS")
else:
    if(fst!=0 and fst>=12 and snd!=0 and snd<=12):
        print("YYMM")
    elif(fst!=0 and fst<=12 and snd!=0 and snd>=12):
        print("MMYY")
    else:
        print("NA")
//  [python]
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
if (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13)and(s2!=0):
    print("MMYY")
elif (s1!=0)and(0<s2<13):
    print("YYMM")
else:
    print("NA")
//  [java]
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		int num1 = Integer.parseInt(s.substring(0, 2));
		int num2 = Integer.parseInt(s.substring(2, 4));
		saori.close();
		if(0 <= num1 && num1 <= 99 && 1 <= num2 && num2 <= 12 && 0 <= num2 && num2 <= 99 && 1 <= num1 && num1 <= 12){
			System.out.println("AMBIGUOUS");
		} else if(0 <= num1 && num1 <= 99 && 1 <= num2 && num2 <= 12){
			System.out.println("YYMM");
		} else if(0 <= num2 && num2 <= 99 && 1 <= num1 && num1 <= 12){
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		int x = Integer.parseInt(S.substring(0, 2));
		int y = Integer.parseInt(S.substring(2, 4));

		int xFlg = 0;
		int yFlg = 0;

		if (1 <= x && x <= 12) {
			xFlg = 1;
		} else if (y != 0) {
			xFlg = 2;
		}

		if (1 <= y && y <= 12) {
			yFlg = 1;
		} else if (y != 0) {
			yFlg = 2;
		}

		if (xFlg == 0 || yFlg == 0 || (xFlg == 2 && yFlg == 2)) {
			System.out.println("NA");
		} else if (xFlg == 1 && yFlg == 1) {
			System.out.println("AMBIGUOUS");
		} else if (xFlg == 1) {
			System.out.println("MMYY");
		} else {
			System.out.println("YYMM");
		}
	}
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		int x = Integer.parseInt(S.substring(0, 2));
		int y = Integer.parseInt(S.substring(2, 4));

		int xFlg = 0;
		int yFlg = 0;

		if (1 <= x && x <= 12) {
			xFlg = 1;
		} else if (1 <= x && x <= 99) {
			xFlg = 2;
		}

		if (1 <= y && y <= 12) {
			yFlg = 1;
		} else if (1 <= y && y <= 99) {
			yFlg = 2;
		}

		if (xFlg == 0 || yFlg == 0) {
			System.out.println("NA");
		} else if (xFlg == 1 && yFlg == 1) {
			System.out.println("AMBIGUOUS");
		} else if (xFlg == 1) {
			System.out.println("MMYY");
		} else {
			System.out.println("YYMM");
		}
	}
}
//  [cpp]
#include<stdio.h>

int main() {
    int n;
    scanf("%d",&n);

    int a = n / 100;
    int b = n % 100;

    if(a >= 1 && a <= 12) {
        if(b >= 1 && b <= 12) {
            puts("AMBIGUOUS");
        } else {
            puts("MMYY");
        }
    } else {
        if(b >= 1 && b <= 12) {
            puts("YYMM");
        } else {
            puts("NA");
        }
    }
}
//  [cpp]
#include<stdio.h>
int main()
{
    int a,ab,cd;
    scanf("%d",&a);
    ab=a/100;
    cd=a%100;
   if(ab>=1 && ab<=12)
   {
       if(cd>=1 && cd<=12)
       {
           printf("AMBIGUOUS\n");
       }
       else printf("MMYY\n");
   }
   else
   {
    if(cd>=1 && cd<=12)
           printf("YYMM\n");
   else printf("NA\n");
   }
    return 0;
}
//  [cpp]
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

int main() {
    char s[10];
    scanf("%s", s);
    int left = (s[0] - '0') * 10 + s[1] - '0';
    int right = (s[2] - '0') * 10 + s[3] - '0';
    if ((left > 12 || left == 0) && right <= 12 && right >= 1) {
        printf("YYMM\n");
    } else if ((right > 12 || right == 0) && left <= 12 && left >= 1) {
        printf("MMYY\n");
    } else if (right >= 1 && right <= 12 && left <= 12 && left >= 1) {
        printf("AMBIGUOUS\n");
    } else {
        printf("NA\n");
    }
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	int m, y;
	cin>>s;
	m = (s[0] - 48) * 10 +(s[1] - 48);
	y = (s[2] - 48) * 10 +(s[3] - 48);

	if((m == 0 || y == 0) &&(m>12 || y >12))
		cout<<"NA\n";
	else if(m>12 && y>12)
		cout<<"NA\n";
	else if(m<=12 && y<=12 && m!=0 && y!=0)
		cout<<"AMBIGUOUS\n";
	else if(y>12 || m>0)
		cout<<"MMYY\n";
	else
		cout<<"YYMM\n";
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	int m, y;
	cin>>s;
	m = (s[0] - 48) * 10 +(s[1] - 48);
	y = (s[2] - 48) * 10 +(s[3] - 48);

	if((m == 0 || y == 0) &&(m>12 || y >12))
		cout<<"NA\n";
	else if(m>12 && y>12)
		cout<<"NA\n";
	else if(m<=12 && y<=12 && m!=0 && y!=0)
		cout<<"AMBIGUOUS\n";
	else if(y>12)
		cout<<"MMYY\n";
	else
		cout<<"YYMM\n";
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	int m, y;
	cin>>s;
	m = (s[0] - 48) * 10 +(s[1] - 48);
	y = (s[2] - 48) * 10 +(s[3] - 48);

	if((m == 0 || y == 0) &&(m>12 || y >12))
		cout<<"NA\n";
	else if(m<=12 && y<=12 && m!=0 && y!=0)
		cout<<"AMBIGUOUS\n";
	else if(y>12)
		cout<<"MMYY\n";
	else
		cout<<"YYMM\n";
}
//  [c]
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
int compare(const void *a,const void *b){
    if(*(long long*)a>*(long long*)b)return 1;
    return -1;
}
int main()
{   int um=0,dm=0;
    char s[5];
    scanf("%s",s);
    if((s[0]=='1'&&(s[1]=='0'||s[1]=='1'||s[1]=='2'))||(s[0]=='0'&&s[1]!='0'))um=1;
if((s[2]=='1'&&(s[3]=='0'||s[3]=='1'||s[3]=='2'))||(s[2]=='0'&&s[3]!='0'))dm=1;
if(um==1&&dm==1)printf("AMBIGUOUS");else if(um==1)printf("MMYY");
else if(dm==1)printf("YYMM");else printf("NA");
    
    return 0;
}
//  [c]
#include <stdio.h>
int main(void)
{
    int i=0, s;
    scanf("%d", &s);
    if(s/100==0 && 1<=s%100 && s%100<=12){
        printf("YYMM\n");
    }
    else if(s/100>=13 && 1<=s%100 && s%100<=12){
        printf("YYMM\n");
    }
    else if(1<=s/100 && s/100<=12 && (s%100>=13 || s%100==0)){
        printf("MMYY\n");
    }
    else if(1<=s/100 && s/100<=12 && 1<=s%100 && s%100<=12){
        printf("AMBIGUOUS\n");
    }
    else{
        printf("NA\n");
    }
        
    return 0;
}
//  [c]
#include <stdio.h>

int type(int s[2])
{
	if ( s[0] == 0 ) {
		if ( s[1] == 0 ) return 0;
		else return 1;
	}
	if ( s[0] == 1 ) {
		if ( s[1] < 3 ) return 1;
		else return 0;
	}
}

int main()
{
	int n = 2;
	int num1[n], num2[n];
	for ( int i = 0; i < n; i++ ) {
		scanf("%1d", &num1[i]);
	}
	for ( int i = 0; i < n; i++ ) {
		scanf("%1d", &num2[i]);
	}
	if ( type(num1) == 1 ) {
		if ( type(num2) == 1 ) printf("AMBIGUOUS");
		else printf("MMYY");
	} else {
		if ( type(num2) == 1 ) printf("YYMM");
		else printf("NA");
	}
	printf("\n");
	return 0;
}
//  [c]
#include <stdio.h>


int main(void) {
	int input_num = 0;
	int YYMM_flag1 = 0;
	int YYMM_flag2 = 0;
	int MMYY_flag1 = 0;
	int MMYY_flag2 = 0;

	
	if(scanf("%d", &input_num)==1);

	if (0 <= (input_num % 100) && (input_num % 100) <= 99) {
		MMYY_flag1 = 1;
		if (1 <= (input_num / 100) && (input_num / 100) <= 12) {
			MMYY_flag2 = 1;
		}
	}
	if (1 <= (input_num % 100) && (input_num % 100) <= 12) {
		YYMM_flag1 = 1;
		if (1 <= (input_num / 100) && (input_num / 100) <= 99) {
			YYMM_flag2 = 1;
		}
	}
	if (MMYY_flag1 == 1 && MMYY_flag2 == 1 && YYMM_flag1 == 1 && YYMM_flag2 == 1) {
		printf("AMBIGUOUS\n");
	}
	else if (MMYY_flag1 == 1 && MMYY_flag2 == 1 && (YYMM_flag1 == 0 || YYMM_flag2 == 0)) {
		printf("MMYY\n");
	}
	else if ((MMYY_flag1 == 0 || MMYY_flag2 == 0) && YYMM_flag1 == 1 && YYMM_flag2 == 1) {
		printf("YYMM\n");
	}
	else {
		printf("NA\n");
	}

}
//  [c]
#include <stdio.h>


int main(void) {
	int input_num = 0;
	int YYMM_flag1 = 0;
	int YYMM_flag2 = 0;
	int MMYY_flag1 = 0;
	int MMYY_flag2 = 0;


	scanf("%d", &input_num);

	if (0 <= (input_num % 100) && (input_num % 100) <= 99) {
		MMYY_flag1 = 1;
		if (1 <= (input_num / 100) && (input_num / 100) <= 12) {
			MMYY_flag2 = 1;
		}
	}
	if (1 <= (input_num % 100) && (input_num % 100) <= 12) {
		YYMM_flag1 = 1;
		if (1 <= (input_num / 100) && (input_num / 100) <= 99) {
			YYMM_flag2 = 1;
		}
	}
	if (MMYY_flag1 == 1 && MMYY_flag2 == 1 && YYMM_flag1 == 1 && YYMM_flag2 == 1) {
		printf("AMBIGUOUS\n");
	}
	else if (MMYY_flag1 == 1 && MMYY_flag2 == 1 && (YYMM_flag1 == 0 || YYMM_flag2 == 0)) {
		printf("MMYY\n");
	}
	else if ((MMYY_flag1 == 0 || MMYY_flag2 == 0) && YYMM_flag1 == 1 && YYMM_flag2 == 1) {
		printf("YYMM\n");
	}
	else {
		printf("NA\n");
	}

}
//  [javascript]
function main(input) {

        const bottom = input % 100;
        const top = (input - bottom) / 100;

        const isMonth = m => (1 <= m) && (m <= 12);
        const isBottomInMonth = isMonth(bottom);
        const isTopInMonth = isMonth(top);

        if ((!isBottomInMonth) && (!isTopInMonth)) {
                console.log('NA');
        }
        else if ((isBottomInMonth) && (isTopInMonth)) {
                console.log('AMBIGUOUS');
        }
        else if (isBottomInMonth) {
                console.log('YYMM');
        }
        else {
                console.log('MMYY');
        }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input){
  const S=parseInt(input,10);
  if( (Math.floor(S/100)>=13 || Math.floor(S/100)==0) && ( ((S%100)>=13) ||(S%100)==0)){
    console.log("NA");
  }else if(Math.floor(S/100)>=13 || Math.floor(S/100)==0){
    console.log("YYMM");
  }else if((S%100)>=13 || (S%100)==0){
    console.log("MMYY");
  }else{
    console.log("AMBIGUOUS");
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  	var f = parseInt(input.substring(0, 2));
  	var s = parseInt(input.substring(2));
  	var r;
  
  	if (f === 0) {
      if (s > 12) r = "NA";
      else if (s === 0) r = "NA";
      else r = "YYMM";
    }
  	else if (s === 0) {
      if (f > 12) r = "NA";
      else if (f === 0) r = "NA";
      else r = "MMYY";
    }
  	else {
      if (f > 12 && s > 12) r = "NA";
      else if (f <= 12 && s <= 12) r = "AMBIGUOUS";
      else if (f <= 12 && s > 12) r = "MMYY";
      else if (f > 12 && s <= 12) r = "YYMM";
    }
  	
	//出力
	console.log(r);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  const S = input.toString().match(/.{2}/g).map(n => parseInt(n, 10));

  if (S[0] <= 12 && S[1] <= 12 && (S[0] > 0 || S[1] > 0)) {
    console.log('AMBIGUOUS');
  }
  else if (S[0] <= 12 && S[0] > 0) {
    console.log('MMYY');
  }
  else if (S[1] <= 12 && S[1] > 0) {
    console.log('YYMM');
  }
  else { 
    console.log('NA');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var s = nextCharArray();
	var mae = myconv(s[0] + s[1],1);
	var ato = myconv(s[2] + s[3]);
	if(mae >= 1 && mae < 13 && ato >= 1 && ato < 13){
		myout("AMBIGUOUS")
	}else if(mae >= 13 && ato >= 1 && ato < 13){
		myout("YYMM");
	}else if(mae >= 1 && mae < 13 && ato >= 13){
		myout("MMYY");
	}else{
		myout("NA");
	}
}
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let s = next()
    let m = ["01","02","03","04","05","06","07","08","09", "10","11","12"]
    const first = s.slice(0,2)
    const second = s.slice(3)
    if(m.includes(first) && m.includes(second)){
        console.log("AMBIGUOUS")
        return
    } else if (m.includes(first) && !m.includes(second)){
        console.log("MMYY")
        return
    } else if (!m.includes(first) && m.includes(second)){
        console.log("YYMM")
        return
    } else {
        console.log("NA")
        return
    }
}
Main()
//  [go]
package main

import "fmt"

var x int
var ok1, ok2 bool

func main() {
  fmt.Scanf("%d", &x)
  
  if 1 <= x/100 && x/100 <= 12 {
    ok1 = true
  }
  if 1 <= x%100 && x%100 <= 12 {
    ok2 = true
  }
  
  if ok1 && ok2 {
    fmt.Println("AMBIGUOUS")
  } else if ok1 {
    fmt.Println("MMYY")
  } else if ok2 {
    fmt.Println("YYMM")
  } else {
    fmt.Println("NA")
  }
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	if isYYMM(s) && isMMYY(s) {
		fmt.Fprintln(writer, "AMBIGUOUS")
		return
	}
	if isYYMM(s) {
		fmt.Fprintln(writer, "YYMM")
		return
	}
	if isMMYY(s) {
		fmt.Fprintln(writer, "MMYY")
		return
	}
	fmt.Fprintln(writer, "NA")
}

func isYYMM(s string) bool {
	return isYY(s[0:2]) && isMM(s[2:4])
}
func isMMYY(s string) bool {
	return isMM(s[0:2]) && isYY(s[2:4])
}

func isYY(s string) bool {
	for i := 0; i < 100; i++ {
		if s == fmt.Sprintf("%02d", i) {
			return true
		}
	}

	return false
}
func isMM(s string) bool {
	for i := 0; i < 12; i++ {
		if s == fmt.Sprintf("%02d", i+1) {
			return true
		}
	}

	return false
}
//  [go]
package main

import (
	"fmt"
	"strconv"
)

func month(s string) bool {
	i, _ := strconv.Atoi(s)
	if i > 0 && i <= 12 {
		return true
	}
	return false
}

func main() {
	var s string
	fmt.Scan(&s)

	first := s[:2]
	last := s[2:]

	if month(first) && month(last) {
		fmt.Println("AMBIGUOUS")
	} else if month(first) {
		fmt.Println("MMYY")
	} else if !month(last) {
		fmt.Println("NA")
	} else {
		fmt.Println("YYMM")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	x, y := stringToInt(s[:2]), stringToInt(s[2:])
	if (x == 0 && y > 12) || (x > 12 && y == 0) {
		fmt.Println("NA")
	} else if x <= 12 && y <= 12 {
		fmt.Println("AMBIGUOUS")
	} else if x > 12 && y > 12 {
		fmt.Println("NA")
	} else if x <= 12 {
		fmt.Println("MMYY")
	} else {
		fmt.Println("YYMM")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	x, y := stringToInt(s[:2]), stringToInt(s[2:])
	if x == 0 || y == 0 {
		fmt.Println("NA")
	} else if x <= 12 && y <= 12 {
		fmt.Println("AMBIGUOUS")
	} else if x > 12 && y > 12 {
		fmt.Println("NA")
	} else if x <= 12 {
		fmt.Println("MMYY")
	} else {
		fmt.Println("YYMM")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	x, y := stringToInt(s[:2]), stringToInt(s[2:])
	if x == 0 || y == 0 {
		fmt.Println("NA")
	} else if x <= 12 && y <= 12 {
		fmt.Println("AMBIGOUS")
	} else if x > 12 && y > 12 {
		fmt.Println("NA")
	} else if x <= 12 {
		fmt.Println("MMYY")
	} else {
		fmt.Println("YYMM")
	}
}
//  [ruby]
s = gets.chomp
x = s[0..1].to_i
y = s[2..3].to_i

if (x > 12 && y > 12) || (x > 12 && y == 0) || (x == 0 && y > 12) || (x == 0 && y == 0)
  puts 'NA'
elsif 0 < x && x <= 12 && 0 < y && y <= 12
  puts 'AMBIGUOUS'
elsif 0 < y && y <= 12
  puts 'YYMM'
elsif x <= 12
  puts 'MMYY'
end
//  [ruby]
s = gets.chomp!

head = s[0, 2].to_i
tail = s[2, 2].to_i

case head
when 0
    head_mm = 0
when 1..12
    head_mm = 1
when 13..99
    head_mm = 2
end

case tail
when 0
    tail_mm = 0
when 1..12
    tail_mm = 1
when 13..99
    tail_mm = 2
end

case [head_mm, tail_mm]
when [0,0], [0,2], [2,0], [2,2]
    puts "NA"
when [0, 1], [2,1]
    puts "YYMM"
when [1,0], [1,2]
    puts "MMYY"
when [1,1]
    puts "AMBIGUOUS"
end
//  [ruby]
S=gets.chomp
s1=S[0..1].to_i
s2=S[2..3].to_i

a=false
b=false
if s1<=12 && s1>0 then
  a=true
end
if s2<=12 && s2>0 then
  b=true
end

if a && b then
  puts 'AMBIGUOUS'
elsif !a && b
  puts 'YYMM'
elsif a && !b
  puts 'MMYY'
else
  puts 'NA'
end
//  [ruby]
s = gets().chomp

s1 = s[0, 2].to_i
s2 = s[2, 2].to_i

s2_is_ok = false
s2 > 0 && s2 < 13
  s2_is_ok = true
end

s1_is_ok = false
s1 > 0 && s1 < 13
  s1_is_ok = true
end

if s1_is_ok && s2_is_ok
  puts 'AMBIGUOUS'
elsif s1_is_ok && !s2_is_ok
  puts 'MMYY'
elsif !s1_is_ok && s2_is_ok
  puts 'YYMM'
else
  puts 'NA'
end
//  [ruby]
s = gets.chomp
if s[0..1].to_i <= 12 && s[2..3].to_i <= 12 && s[0..1].to_i >= 1 && s[2..3].to_i >= 1
    puts "AMBIGUOUS"
elsif s[0..1].to_i <= 12 && s[2..3].to_i > 12 && s[0..1].to_i >= 1
    puts "MMYY"
elsif s[0..1].to_i <= 12 && s[2..3] == "00"
    puts "MMYY"
elsif s[0..1].to_i > 12 && s[2..3].to_i <= 12 && s[2..3].to_i >= 1
    puts "YYMM"
elsif  s[0..1] == "00" && s[2..3].to_i <= 12
    puts "YYMM"
elsif  s[0..1].to_i > 12 && s[2..3].to_i > 12
    puts "NA"
elsif s[0..1] == "00" || s[2..3] == "00"
    puts "NA"
end
//  [ruby]
s = gets.chomp
if s[0..1].to_i <= 12 && s[2..3].to_i <= 12 && s[0..1].to_i >= 1 && s[2..3].to_i >= 1
    puts "AMBIGUOUS"
elsif s[0..1].to_i <= 12 && s[2..3].to_i > 12 && s[0..1].to_i >= 1
    puts "MMYY"
elsif s[0..1].to_i <= 12 && s[2..3] == "00"
    puts "MMYY"
elsif s[0..1].to_i > 12 && s[2..3].to_i <= 12 && s[2..3].to_i >= 1
    puts "YYMM"
elsif  s[0..1] == "00" && s[2..3].to_i <= 12
    puts "YYMM"
elsif  s[0..1].to_i > 12 && s[2..3].to_i > 12
    puts "NA"
elsif s[0..1].to_i == 0 || s[2..3].to_i == 0
    puts "NA"
end
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}



use std::cmp;
use std::ascii::AsciiExt;
use std::iter::Iterator;

fn main() {
    input! {
        s:String,
    }

    let first = &s[0..2];
    let last = &s[2..4];


    let firstNum : i32 = first.parse().unwrap();
    let lastNum : i32 = last.parse().unwrap();


    if firstNum > 0 && firstNum < 13 && lastNum < 13 && lastNum > 0 {
        println!("AMBIGUOUS");
    } else if firstNum <= 12 && firstNum > 0{
        println!("MMYY");
    } else if  lastNum <=  12 && lastNum >0 {
        println!("YYMM")
    }else {
        println!("NA")
    }
}
//  [rust]
fn main() {
    let v: Vec<char> = {
        let s = read::<String>();
        s.chars().into_iter().collect()
    };
    let x = ((v[0] as u8) - b'0') * 10 + (v[1] as u8) - b'0';
    let y = ((v[2] as u8) - b'0') * 10 + (v[3] as u8) - b'0';
    let yymm = 1 <= y && y <= 12;
    let mmyy = 1 <= x && x <= 12;
    let ret = if yymm && mmyy {
        "AMBIGUOUS"
    } else if yymm && !mmyy {
        "YYMM"
    } else if !yymm && mmyy {
        "MMYY"
    } else {
        "NA"
    };
    println!("{}", ret);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}
//  [rust]
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let a = s[0..2].parse::<usize>().unwrap();
    let b = s[2..4].parse::<usize>().unwrap();
    let a_b = (a <= 12) && (a>0);
    let b_b = (b <= 12) && (b>0);
    println!("{}", match (a_b, b_b) {
        (true, true) => "AMBIGUOUS",
        (false, true) => "YYMM",
        (true, false) => "MMYY",
        (false, false) => "NA",
    });
}
//  [rust]
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int main() {
    int s;
    cin >> s;

    int a = s / 100;
    int b = s % 100;

    if (1 <= a && a <= 12) {
        if (1 <= b && b <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if (1 <= b && b <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }

    return 0;
}
//  [rust]
use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: Chars
    };

    let mut is_mmyy = false;
    let mut is_yymm = false;
    let mut is_na = false;

    let s1 = s[0] as i32 - 48;
    let s2 = s[1] as i32 - 48;
    let s3 = s[2] as i32 - 48;
    let s4 = s[3] as i32 - 48;

    let x1 = s1 * 10 + s2;
    let x2 = s3 * 10 + s4;

    if x1 == 0 || x2 == 0 {
        is_na = true;
    }
    if x1 > 12 {
        is_yymm = true;
    }
    if x2 > 12 {
        is_mmyy = true;
    }
    if 0 < x1 && x1 < 13 && 0 < x2 && x2 < 13 {
        is_yymm = true;
        is_mmyy = true;
    }

    if is_na {
        println!("NA");
    } else if is_yymm && is_mmyy {
        println!("AMBIGUOUS");
    } else if is_mmyy {
        println!("MMYY");
    } else {
        println!("YYMM");
    }
}
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let s: String = read!();
    let s = s.chars().collect_vec();

    let a = &s[..2].iter().collect::<String>();
    let b = &s[2..].iter().collect::<String>();

    let a: usize = a.parse().unwrap();
    let b: usize = b.parse().unwrap();

    if a < 13 && b < 13 {
        println!("{}", "AMBIGUOUS");
    } else if a < 13 {
        println!("{}", "MMYY");
    } else if b < 13 {
        println!("{}", "YYMM");
    } else {
        println!("{}", "NA");
    }
}
//  [swift]
let arr=readLine()!

 let characters = arr.characters

var c = 0
var o1 = ""
var o2 = ""
var p : String = ""
for var s in characters {

        if( c < 2 ) {
        p = String(s)
        o1 += p
    } else {
                p = String(s)
        o2 += p
        }
        c += 1
}

var x : Int = Int( o1 )!
var y : Int = Int( o2 )!

if( ( ( x > 0 ) && ( x <= 12 ) ) && ( ( y < 1 ) || ( y > 12 ) ) ) {
  print( "MMYY" )
} else if( ( ( x > 12 || x < 1 ) ) && ( ( y <= 12  ) && ( y > 0 ) ) ) {
  print( "YYMM" )
} else if( ( ( x > 0 ) && ( x <= 12 ) ) && ( ( y <= 12 ) && ( y > 0 ) ) ) {
  print( "AMBIGUOUS" )
} else {
  print( "NA" )
}
//  [swift]
let s = Int(readLine()!)!
let s1 = s / 100
let s2 = s % 100
var c = 0
let l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2 && s2<=12 {c += 1}
if 1<=s1 && s1<=12 {c += 2}
print(l[c])
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** メインプログラム ***************/

let S = readInt()!
let Y = S / 100
let M = S % 100
var ans = "YYMM"
if M > 12 || M == 0 {
    if Y > 12 || Y == 0 {
        ans = "NA"
    } else {
        ans = "MMYY"
    }
} else if Y > 0 && Y <= 12{
    ans = "AMBIGUOUS"
}
print(ans)
//  [swift]
s = int(input())
s1 = s // 100
s2 = s % 100
c = 0
l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2<=12:
  c += 1
if 1<=s1<=12:
  c += 2
print(l[c])
//  [swift]
import Foundation
let S = readLine()!

let first = Int(S.substring(with: NSRange(location: 0, length: 2)))
let second = Int(S.substring(with: NSRange(location: 2, length: 2)))

if let f = first, let s = second, 1...12 ~= f || 1...12 ~= s  {
  if f > 12 {
    print("YYMM")
  } else if s > 12 {
    print("MMYY")
  } else {
    print("AMBIGUOUS")
  }
} else {
  print("NA")
}
//  [swift]
let arr=readLine()!

 let characters = arr.characters

var c = 0
var o1 = ""
var o2 = ""
var p : String = ""
for var s in characters {

        if( c < 2 ) {
        p = String(s)
        o1 += p
    } else {
                p = String(s)
        o2 += p
        }
        c += 1
}

var x : Int = Int( o1 )!
var y : Int = Int( o2 )!

if( ( ( x > 0 ) || ( x <= 12 ) ) && ( ( y < 1 ) || ( y > 12 ) ) ) {
  print( "MMYY" )
} else if( ( ( x > 12 || x < 1 ) ) && ( ( y <= 12  ) || ( y < 1 ) ) ) {
  print( "YYMM" )
} else if( ( ( x > 1 ) || ( x <= 12 ) ) && ( ( y >= 12 ) || ( y < 1 ) ) ) {
  print( "AMBIGUOUS" )
} else {
  print( "NA" )
}
//  [typescript]
const main = (line) => {
	const Ns = [line.substring(0,2),line.substring(2,4)].map(Number)
  if(Ns[0] <= 12 && Ns[0] > 0 && Ns[1] <= 12 && Ns[1] > 0 )  return console.log("AMBIGUOUS")
  if((Ns[0] === 0 || Ns[0] > 12) && Ns[1] <= 12 && Ns[1] > 0)  return console.log("YYMM")
  if(Ns[0] <= 12 && Ns[0] > 0 && (Ns[1] === 0 || Ns[1] > 12))  return console.log("MMYY")
  console.log("NA")
  }

main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [typescript]
//*
// yarn compile template.ts で監視可能
{
  const pattern = {
    yymm: "YYMM",
    mmyy: "MMYY",
    ambiguous: "AMBIGUOUS",
    na: "NA",
  }
  const process = (a: string): string => {
    const firstHalf = parseInt(a.substring(0, 2))
    const latterHalf = parseInt(a.substring(2))

    let isFirstYy = false
    let islatterYy = false

    if (firstHalf === 0 || firstHalf > 12) {
      // firstHalf === yy
      isFirstYy = true
    }
    if (latterHalf === 0 || latterHalf > 12) {
      // latterHalf === yy
      islatterYy = true
    }

    if (isFirstYy && islatterYy) {
      return pattern.na
    }
    if (isFirstYy) {
      return pattern.yymm
    }
    if (islatterYy) {
      return pattern.mmyy
    }
    return pattern.ambiguous
  }

  const Main = (input: string): string => {
    //const n: number = parseInt(input)
    //const a: string[]  = input.split(" ")
    //const aa: string[][]  = input.split("\n").split(" ")
    const res = process(input)
    console.log(res)
    return res
  }
  Main(require("fs").readFileSync("/dev/stdin", "utf8"))
}

// */
//  [typescript]
const main = (input: string) => {
  const YY = parseInt(input.slice(0, 2));
  const MM = parseInt(input.slice(2, 4));
  let answer: string = "NA";

  if (isInMonth(YY) && isInMonth(MM)) {
    answer = "AMBIGUOUS";
  } else if (isInMonth(MM)) {
    answer = "YYMM";
  } else if (isInMonth(YY)) {
    answer = "MMYY";
  }

  console.log(answer);
};

const isInMonth = (num: number) => {
  const min = 1;
  const max = 12;
  return num >= min && num <= max;
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
((input: string): void => {
    const hoge = input.trim().split("");
    const fuga = (p, q) => Number(hoge.slice(p, q).join(""));
    const [a, b] = [fuga(0,2), fuga(2,4)];
    console.log((() => {
        if ((0 < a && a <= 12) && (12 > b && b <= 31)) {return "MMYY"}
        else if((12 < a && a <= 31) && (0 < b && b <= 12)) {return "YYMM"}
        else if((0 < a && a <= 12) && (b <= 12)) {return "AMBIGUOUS"}
        else {return "NA"}
    })());
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main = (input: string) => {
  const YY = parseInt(input.slice(0, 2));
  const MM = parseInt(input.slice(2, 4));
  let answer: string = "NA";

  if (MM > 0 && MM <= 12 && YY > 0 && MM <= 12) {
    answer = "AMBIGUOUS";
  } else if (MM > 0 && MM <= 12) {
    answer = "YYMM";
  } else if (YY > 0 && YY <= 12) {
    answer = "MMYY";
  }

  console.log(answer);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input = "0112";

const main = (input: string) => {
  const YY = parseInt(input.slice(0, 2));
  const MM = parseInt(input.slice(2, 4));
  const [YYMM, MMYY, AMBIGUOUS, NA] = ["YYMM", "MMYY", "AMBIGUOUS", "NA"];
  let answer: string = NA;

  if (MM > 0 && MM >= 12 && YY > 0 && MM >= 12) {
    answer = AMBIGUOUS;
  } else if (MM > 0 && MM <= 12) {
    answer = YYMM;
  } else if (YY > 0 && YY <= 12) {
    answer = MMYY;
  }

  console.log(answer);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
N = int(input())
input_array = list(map(int,input().split()))
day = input_array[0]
left = input_array[1]
out = 0
out += left

for i in range(N):
    temp = int(input())
    out += (1+int((day-1)/temp))


print(out)
//  [python]
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]
for i in range(len(A)):
    day = 1
    while day <= D:
        day += A[i]
        X += 1
print(X)
//  [python]
import sys

n=int(input())
d,x=map(int,input().split())
a=[]
choco=0
for i in range(n):
    a=int(input())
    choco+=1+d//a
    if(d%a==0):choco-=1
print(choco+x)
//  [python]
n = int(input())
d,x = [int(t) for t in input().split()]
a = []
for i in range(n):
  a.append(int(input()))
res = 0
for i in range(n):
  c = a[i]
  res += 1
  while c < d:
    res += 1
    c += a[i]
  print(i,res)
res += x
print(res)
//  [python]
N = int(input())
D,X = input().split()
x = 0
for n in range(N):
  An = int(input())
  x += 1+(N-1)//An
print(str(x)+X)
//  [python]
n=int(input())
d,x=map(int,input().split())
cnt = n
for i in range(n):
    a = int(input())
    p = 1
    while p <= d:
        p +=a
        cnt +=1
print(cnt+x)