Run error in ENGRIS

Can someone please tell me error in my code for ENGRIS from project code 2.0 . Link to code is https://pastebin.com/66X0wvCX

try this magical input.

1
1 1
aaa
aa