import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
}



 import java.util.*; util.* java import java.util.HashSet; HashSet java.util import java.util.Map; Map java.util import java.util.HashMap; HashMap java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int s_front = s / 100; s_front s / 100 s 100 int s_back = s % 100; s_back s % 100 s 100 if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } 0 < s_front && s_front < 13 0 < s_front 0 s_front s_front < 13 s_front 13 {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            } 0 < s_back && s_back < 13 0 < s_back 0 s_back s_back < 13 s_back 13 {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            } 0 < s_back && s_back < 13 0 < s_back 0 s_back s_back < 13 s_back 13 {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
                System.out.println("NA");
            } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main
import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int s_front = s / 100;
        int s_back = s % 100;

        if (0 < s_front && s_front < 13) {
            if (0 < s_back && s_back < 13) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (0 < s_back && s_back < 13) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
}




