#include <iostream>
using namespace std;
int main(){
int a[10][10];
for (int i = 0;i < 5;i ++){
for (int j = 0;j < 5;j ++){
cin >> a[i][j];
}
}
for (int i = 0;i < 5;i ++){
for (int j = 4;j > 0;j --){
swap(a[i][j],a[i][j - 1]);
}
}
for (int i = 0;i < 5;i ++){
for (int j = 0;j < 4;j ++){
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}