#include<iostream>
using namespace std;
int main(){
int a2d[2][3] = {
{1,2,3},
{4,5,6}
}
int(*p2d)[3] = a2d;
for(int a=0;a<=2;a++){
int list1 = 0;int list2 = 0;
list1 += *(*p2d + a);
list2 += *(*(p2d+1)+ a);
}
if(list1>list2){
for(int i = 0;i<=2;i++){
for(int j = 0;j<=3;j++){
cout<<a2d[i][j]<<endl;
}
}
}
else(list2>list1){
for(int i = 2;i>=0;i--){
for(int j = 0;j<=3;j++){
cout<<a2d[i][j]<<endl;
}
}
}
return 0;
}