Under construction

Still being built. Things may change

Cat Food

Interview

Time limit1sMemory limit1024 MB

Summary
Given a binary picture rotated 90 degrees counterclockwise, check whether it equals the students' picture under the reverse rotation.
Level

Easy3 of 10

Topics
Implementation, Matrix, Simulation, Array
Solved
No attempts yet

Problem

Hwang Tolic, a cat living in a house in the grass at The Catholic University of Korea, is far more sensitive than other cats. The Tolic household has a photo of cat food that they have kept on display since they were young, and the family eats the food the students handed out only when it matches the food in the photo. But the wind has turned the photo 90 degrees counterclockwise, so the Tolic family cannot eat.

The Tolic family is too short to turn the photo back. For their sake, determine whether the food the students handed out can be eaten, and show the surprised cat (sample output 1) if it cannot, or the winking cat (sample output 2) if it can!

Input

The first line gives the integers R and C, the number of columns and rows of the food picture that the wind turned 90 degrees counterclockwise. (1 ≤ R, C ≤ 100) From the second line, the food positions are given as 1s and 0s according to the number of rows and columns. After the food picture, the next lines give the food the students handed out. The rows and columns of the students' food are the reverse of the rows and columns of the food picture, so they are not given separately.

Output

If Tolic can eat the food the students gave, output the winking cat; otherwise output the surprised cat.

Examples2

  1. Example 1

    Input
    5 5
    0 0 0 1 0
    1 0 0 1 0
    1 1 1 1 1
    0 1 0 1 1
    0 1 0 1 1
    0 0 1 1 0
    0 1 1 0 0
    0 0 1 0 0
    1 0 1 1 1
    1 0 1 0 0
    
    Expected output
    |>___/|     /}
    | O O |    / }
    ( =0= )""""  \
    | ^  ____    |
    |_|_/    ||__|
    
  2. Example 2

    Input
    5 15
    1 0 1 1 0
    1 0 0 1 1
    0 1 0 0 0
    1 1 1 1 1
    1 0 1 0 0
    1 0 1 1 1
    1 0 0 0 1
    0 1 0 0 1
    1 0 1 0 1
    1 1 1 1 0
    0 1 0 0 0
    1 0 0 1 0
    1 0 0 1 0
    1 1 1 1 1
    1 1 1 0 0
    1 1 1 1 0 1 1 0 1 1 1 1 0 1 1
    1 1 0 0 1 1 0 1 0 0 0 1 1 0 0
    1 1 0 0 0 1 1 0 0 1 1 1 0 0 1
    0 1 1 1 0 1 0 0 0 1 0 1 0 1 1
    0 1 0 0 0 0 1 1 1 1 0 1 0 1 0
    
    Expected output
    |>___/|        /}
    | O < |       / }
    (==0==)------/ }
    | ^  _____    |
    |_|_/     ||__|