// Can some one please look into my code snippet for the ADAKNG Problem
// and point out why my code is not accepted . The code is in C++
//Thank you.
#include <iostream>
using namespace std;
int main()
{
int t,r,c,k;
int y;
int dr,ur,fc,bc;
/* dr = lower_most_row
ur = upper_most_row
fc = right_most_column
bc = left_most_column
*/
int no_of_squares;
dr = 0;
fc = 0;
ur = 8;
bc = 8;
cin>>t;
while(t--)
{
cin>>r>>c>>k;
for(y=k;y>=0;y--)
{
if( (1 <= (r+y)) && ((r+y) <= 8) )//if the row exists
if((r+y) > dr)// if the new value is lower than current row
dr = (r+y);
if( (1 <= (r-y)) && ((r-y) <= 8) )// if the row exists
if((r-y) < ur)// if the new value is higher than current row
ur = (r-y);
if( (1 <= (c+y)) && ((c+y) <= 8) )//if the column exists
if((c+y) > fc)// if the new value is more right than current column
fc = (c+y);
if((1 <= (c-y)) && ((c-y) <= 8))//if the column exists
if((c-y) < bc)// if the new value is more left than current column
bc = (c-y);
}
no_of_squares = (dr - ur + 1) * (fc - bc + 1);
cout<<no_of_squares<<"\n";
}
return 0;
}