Bobo has 

 points arranged into a matrix with n rows and m columns. The points in the intersection of the i-th row and the j-th column is labeled with (i, j).
 He is going to perform q operations of the following 2 kinds.
 1. Given parameters a, b, add edges between points (i, j) and (i, j + 1) for all 

 and 

.
 2. Given parameters a, b, add edges between points (i, j) and (i + 1, j) for all 

 and 

.
 Bobo would like to know the number of connected components after each operation.
输入描述:
                                                    The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains three integers n, m and q.
The i-th of the following q lines contains three integers  ,
,  and
 and  where
 where  is the kind of the operation i and
 is the kind of the operation i and  ,
,  are corresponding parameters.
 are corresponding parameters.
                                                                            输出描述:
                                                    For each test case, print q integers which denote the number of connected components after each operation.
                                                                            
                        
                            示例1
                        
                        
                            
                                输入
                                复制
                                
                                
                                    2 3 3
2 1 1
2 3 3
1 1 1
1000000000 1000000000 1
1 1 2
                                 
                             
                            
                                                     
                     
                                                        备注:
                * 
* 
* 
* If  ,
,  . If
. If  ,
,  .
.
* The sum of q does not exceed  .
.