Masala #0437

Xotira 16 MB Vaqt 1000 ms
14

Matritsada yurish

Sizga \(N \times N\) o’lchamli qiymati faqatgina 0, 1, 2 lardan tashkil topgan matritsa berilgan. Matritsaning ikki katagi qo’shni bo’lsa (diagonal bo’yicha ham qo’shni bo’lishi mumkin) ularning biridan ikkinchisiga yurish mumkin. 

Matritsani mutaxassislar quyidagicha baholashadi:

  • Birinchi qatordan oxirgi qatorga faqat 1 lar ustidan yurib kelishning imkoni bo’lsa matritsa “ZO’R” hisoblanadi
  • Birinchi ustundan oxirgi ustunga faqat 2 lar ustidan yurib kelishning imkoni bo’lsa matritsa “AJOYIB” hisoblanadi
  • Matritsa yuqoridagi ikkala shartni ham qanoatlantirsa matritsa “MUKAMMAL” hisoblanadi
  • Yuqoridagi hech bir shartni qanoatlantirmasa matritsa “ODDIY” hisoblanadi

Kiruvchi ma'lumotlar:

Kirish faylining dastlabki satrida bitta butun son, \(N (1 \le N \le 100)\) soni kiritiladi

Keyingi \(N\) ta qatorda \(N\) tadan butun son, ya’ni matritsa elementlari kiritiladi


Chiquvchi ma'lumotlar:

Mutaxassislar tomonidan matritsa qanday baholanganligini chop eting.


Misollar
# input.txt output.txt
1
3
0 0 1
0 1 2
2 2 1
MUKAMMAL