Is it possible to obtain dynamic tree with two dimensions in big matrix
Yes.  Use a persistent data structure.  Build a tree data structure to answer queries of the form $q(i,0)$.  Then, advance $j$, updating the persistent tree data structure as you do.  This will build a data structure of size $k$ and let you answer queries in $O(\log k)$ time, where $k$ is the number of non-zero entries in the matrix.