Storing input queries
let v = new Array ( q ) . fill ( 0 ) . map ( ( ) => new Array ( 2 ) . fill ( 0 ) . map ( ( ) => new Array ( 2 ) . fill ( 0 ) ) ) ; v [ 0 ] [ 0 ] [ 0 ] = 1 ; v [ 0 ] [ 0 ] [ 1 ] = 5 ; v [ 0 ] [ 1 ] = 3 ; v [ 1 ] [ 0 ] [ 0 ] = 4 ; v [ 1 ] [ 0 ] [ 1 ] = 8 ; v [ 1 ] [ 1 ] = 7 ; v [ 2 ] [ 0 ] [ 0 ] = 6 ; v [ 2 ] [ 0 ] [ 1 ] = 9 ; v [ 2 ] [ 1 ] = 1 ;