import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line = br.readLine(); line br.readLine() br.readLine br int front = Integer.parseInt(line.substring(0, 2)); front Integer.parseInt(line.substring(0, 2)) Integer.parseInt Integer line.substring(0, 2) line.substring line 0 2 int rear = Integer.parseInt(line.substring(2, 4)); rear Integer.parseInt(line.substring(2, 4)) Integer.parseInt Integer line.substring(2, 4) line.substring line 2 4 String result = "NA"; result "NA" if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    } front>=1 && front<=12 && rear>=1 && rear<=12 rear>=1 front>=1 && front<=12 && rear>=1 && rear<=12 front>=1 front 1 front<=12 front 12 rear>=1 rear 1 rear<=12 rear 12 {
      result = "AMBIGUOUS";
    } result = "AMBIGUOUS" result "AMBIGUOUS" if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    } rear>=1 && rear<=12 rear>=1 rear 1 rear<=12 rear 12 {
      result = "YYMM";
    } result = "YYMM" result "YYMM" if(front>=1 && front<=12){
      result = "MMYY";
    } front>=1 && front<=12 front>=1 front 1 front<=12 front 12 {
      result = "MMYY";
    } result = "MMYY" result "MMYY" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String line = br.readLine();
    int front = Integer.parseInt(line.substring(0, 2));
    int rear = Integer.parseInt(line.substring(2, 4));
    
    String result = "NA";
    
    if(front>=1 && front<=12 && rear>=1 && rear<=12){
      result = "AMBIGUOUS";
    }else if (rear>=1 && rear<=12){
      result = "YYMM";
    }else if(front>=1 && front<=12){
      result = "MMYY";
    }
    
    System.out.println(result);
  }
}
