Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0183 - BLACK SQUARE

 

   Inspired by Kazimir Malevich’s masterpiece “Black Square”, Peter Palevich is planning to create his own version. He prepared a rectangular grid containing m × n white cells arranged in m rows of n cells each.

   Peter painted some of the cells black, so that the black cells formed a square of size s × s cells. But later that day Peter became disappointed with his painting and destroyed it, cutting it to horizontal stripes of size 1 × n and burning them in the fireplace.

   Next morning Peter changed his mind and decided to restore his painting. He tried to find its remains in the fireplace, and fortunately one of the stripes, namely the k-th from the top, survived the fire.

   Now Peter wonders whether it is possible to restore the painting based on this stripe. Help him to do it.

Input

   The first line of the input file contains four integer numbers:  m, n, s and k (1 m, n 5000; 1 s min(m, n); 1 k m).

   The second line contains n characters and describes the k-th line of the painting, ‘.’ stands for a white cell, ‘*’ stands for a black cell.

Output

   If the initial painting can be uniquely restored, output “Unique”.

   If there are several paintings that could have been painted by Peter, output “Ambiguous”. If there are no possible paintings, output “Impossible”.

Examples

stdin

stdout

1

4 4 1 2

..*.

Unique

2

4 4 2 2

..**

Ambiguous

3

4 4 3 2

.*.*

Impossible

 


Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-04-09
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Northern QF 2011.B

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.