nauuo girl love play game relate portalsone day playing game followsIn ntime n grid row number 1 n column number 1 n leave right we denote cell intersection rth row cth column rca portal pair door you travel change direction more formally walk cell door teleport cell door portal walk cell face original direction there door single cellThe cell near cell direction face for example face cell 25 35if walk cell door walk cell change direction if cell exist exit gridyou set possibly zero portal grid walk i1 face right eventually exit grid r_in walk 1 face exit grid nc_iIt guarantee r_1n c_1n permutation n element a permutation n element sequence number p_1p_2ldotsp_n integer 1 n appear exactly onceshe get confused playing game help find solution