#include <iostream>
using namespace std;
void search_min_id(int a[3][4],int i1,int j1,int i2,int j2,int *xid,int *yid)
{
int min,x,y;
*xid=i1;
*yid=j1;
min=a[i1][j1];
for (x=i1;x<=i2;x++)
{
for (y=j1;y<=j2;y++)
{
if(min>a[x][y])
{
min=a[x][y];
*xid=x;
*yid=y;
}
}
}
return;
}
int main()
{
int x,i1=0,i2=0,j1=0,j2=0,a[3][4],N=3,M=4;
for (int i = 0; i < N; ++i)
{
for (int j = 0; j < M; ++j)
{
cin >> a[i][j];
}
}
search_min_id(a,1,1,3,2,&i1,&j1);
search_min_id(a,1,3,3,4,&i2,&j2);
x=a[i1][j1];
a[i1][j1]=a[i2][j2];
a[i2][j2]=x;
for (int i = 0; i < N; ++i)
{
for (int j = 0; j < M; ++j)
{
cout << a[i][j];
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBzZWFyY2hfbWluX2lkKGludCBhWzNdWzRdLGludCBpMSxpbnQgajEsaW50IGkyLGludCBqMixpbnQgKnhpZCxpbnQgKnlpZCkKewogICAgaW50IG1pbix4LHk7CiAqeGlkPWkxOwogKnlpZD1qMTsKIG1pbj1hW2kxXVtqMV07CiBmb3IgKHg9aTE7eDw9aTI7eCsrKQogewogIGZvciAoeT1qMTt5PD1qMjt5KyspCiAgewogICBpZihtaW4+YVt4XVt5XSkKICAgIHsKICAgbWluPWFbeF1beV07CiAgICp4aWQ9eDsKICAgKnlpZD15OwogICAgfQogIH0KIH0KICAgIHJldHVybjsKfQoKaW50IG1haW4oKSAKewogaW50IHgsaTE9MCxpMj0wLGoxPTAsajI9MCxhWzNdWzRdLE49MyxNPTQ7CiAKIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgKytpKQp7CiBmb3IgKGludCBqID0gMDsgaiA8IE07ICsraikKIHsKICBjaW4gPj4gYVtpXVtqXTsKIH0KfQogc2VhcmNoX21pbl9pZChhLDEsMSwzLDIsJmkxLCZqMSk7CiBzZWFyY2hfbWluX2lkKGEsMSwzLDMsNCwmaTIsJmoyKTsKIHg9YVtpMV1bajFdOwogYVtpMV1bajFdPWFbaTJdW2oyXTsKIGFbaTJdW2oyXT14OwogCiAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyArK2kpCnsKIGZvciAoaW50IGogPSAwOyBqIDwgTTsgKytqKQogewogIGNvdXQgPDwgYVtpXVtqXTsKICAgfQogIH0KcmV0dXJuIDA7Cn0K