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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br int left = Integer.parseInt(str.substring(0, 2)); left Integer.parseInt(str.substring(0, 2)) Integer.parseInt Integer str.substring(0, 2) str.substring str 0 2 int right = Integer.parseInt(str.substring(2, 4)); right Integer.parseInt(str.substring(2, 4)) Integer.parseInt Integer str.substring(2, 4) str.substring str 2 4 if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    } 1 <= left && left <= 12 1 <= left 1 left left <= 12 left 12 {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      } 1 <= right && right <= 12 1 <= right 1 right right <= 12 right 12 {
        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 (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    } if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      } 1 <= right && right <= 12 1 <= right 1 right right <= 12 right 12 {
        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) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int left = Integer.parseInt(str.substring(0, 2));
    int right = Integer.parseInt(str.substring(2, 4));
    if (1 <= left && left <= 12) {
      if (1 <= right && right <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (1 <= right && right <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

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