#include <cstdio>
#include <algorithm>
using namespace std;
int T[ 1000007 ] ;
int A[ 1000007 ] ;
int P[ 1000007 ] ;
int main( )
{
int t, n;
scanf ( "%d" , & t) ;
for ( int zi= 0 ; zi< t; zi++ )
{
scanf ( "%d" , & n) ;
for ( int i = 0 ; i < n; i++ ) scanf ( "%d" , & T[ i] ) ;
bool ok = true ;
for ( int i = 0 ; i < n/ 2 ; i++ )
{
int suma = T[ i] + T[ n- 1 - i] ;
if ( suma & 1 ) ok = false ;
P[ i] = suma/ 2 ; P[ n- 1 - i] = P[ i] ;
A[ i] = T[ i] - P[ i] ;
A[ n- 1 - i] = T[ n- 1 - i] - P[ n- 1 - i] ;
}
if ( ok)
{
for ( int i = 0 ; i < n; i++ ) printf ( "%d " , P[ i] ) ;
printf ( "\n " ) ;
for ( int i = 0 ; i < n; i++ ) printf ( "%d " , A[ i] ) ;
printf ( "\n " ) ;
} else printf ( "NIE\n " ) ;
}
return 0 ;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGFsZ29yaXRobT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgVFsxMDAwMDA3XTsKaW50IEFbMTAwMDAwN107CmludCBQWzEwMDAwMDddOwogCiAKaW50IG1haW4oKQp7CglpbnQgdCwgbjsKIAoJc2NhbmYoIiVkIiwgJnQpOwoJZm9yKGludCB6aT0wOyB6aTx0OyB6aSsrKQoJewoJCXNjYW5mKCIlZCIsICZuKTsKCQlmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSBzY2FuZigiJWQiLCAmVFtpXSk7CiAKCQlib29sIG9rID0gdHJ1ZTsKCQlmb3IoaW50IGkgPSAwOyBpIDwgbi8yOyBpKyspIAoJCXsKCQkJaW50IHN1bWEgPSBUW2ldICsgVFtuLTEtaV07CgkJCWlmIChzdW1hICYgMSkgb2sgPSBmYWxzZTsKCQkJUFtpXT1zdW1hLzI7IFBbbi0xLWldPVBbaV07CgkJCUFbaV09VFtpXS1QW2ldOwoJCQlBW24tMS1pXSA9IFRbbi0xLWldIC0gUFtuLTEtaV07CgkJfQoJCWlmIChvaykKCQl7CgkJCWZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHByaW50ZigiJWQgIiwgUFtpXSk7CgkJCXByaW50ZigiXG4iKTsKCQkJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgcHJpbnRmKCIlZCAiLCBBW2ldKTsKCQkJcHJpbnRmKCJcbiIpOwoJCX1lbHNlIHByaW50ZigiTklFXG4iKTsKIAoJfQoJcmV0dXJuIDA7Cn0KIA==
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout
1 1
0 0
3 3 3 3
-2 -1 1 2
NIE