#include #include using namespace std; #include #include template struct Matrix{ vector >dat; int N,M;//N x M matrix Matrix(){} Matrix(int N_):Matrix(N_,N_){} Matrix(int N_,int M_):N(N_),M(M_),dat(N_,vector(M_)){} vector&operator[](int i){return dat[i];} const vector&operator[](int i)const{return dat[i];} static Matrix eye(int N) { Matrix res(N); for(int i=0;i>=1)if(n&1)res=res*a; return res; } template Matrix operator+(const U&A)const { Matrix res(N,M); for(int i=0;i Matrix operator-(const U&A)const { Matrix res(N,M); for(int i=0;i Matrix operator*(const U&A)const { Matrix res(N,M); for(int i=0;i; int N,M; long T; main() { cin>>N>>M>>T; mat A(N); for(int i=0;i>u>>v; A[u][v]=A[v][u]=1; } cout<