Marzz liked a strange way of memorizing words.
Now these words are placed in an Matrix. He decided to memorize only one line or one column of words every day. She has memorized
days in total, and now she wants to know: for each word, when was the last time she memorized it?