Quantum walk on two-dimensional torus and grid