시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3 3 3 100.000%

문제

The digital display clock installed in problem 6634 is only one part of the solution to eliminate antedating documents. The second part is a camera which takes pictures of the office regularly and records at what times was each document signed and stamped. These records can later serve as an evidence.

Your task is to scan a picture take by the camera and decode numbers on the digital display.

입력

The input will exactly follow Output Specification for Problem 6634, with only one important exception: Since image scanning is always an error-prone process, some of the characters representing the display may not be recognized correctly. Fortunately, we know which characters are incorrect, because a very sophisticated error-detecting mechanism is used. These characters are replaced by dots (“.”) in the input. Such spots can represent any of the allowed characters.

출력

Your output must follow Input Specification for Problem 6634. For each display, output the time shown on it. You may assume that at least one such time exists.

However, due to the scanning errors, sometimes there may be several possible valid times that could be represented by the same picture. In such cases, we may not risk giving an incorrect information — print the word “ambiguous” instead of the time.

예제 입력 1

....+  +---+     +---+  +---+
...|  |          .....     |
...|  |      .      ..   ...
....+  +-...     +--....    +
......     |  o  |   .....  |
. . .     ...   ....        |
....+  +---+     +---+      +

....+  +---+     +---+  +---+
...|      |      .....     |
...|      |  .      ..   ...
....+  +-...     +--....    +
......     |  o  |   .....  |
. . .     ...   ....        |
....+  +---+     +---+      +

end


예제 출력 1

15:27
ambiguous
end