#include <iostream>
#include <fstream>
using namespace std;
int main() {
const int n = 5;
int a[n][n];
ifstream fin("text.txt"); // открыли файл для чтения
for (int j=0; j< n; j++){
for (int i =0; i < n; i++){
fin >> a[i][j];
cout << a[i][j] << " ";
if (i == (n-1)){
cout << endl;
}
}
}
cin.get();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewpjb25zdCBpbnQgbiA9IDU7CgppbnQgYVtuXVtuXTsKCgogICAgaWZzdHJlYW0gZmluKCJ0ZXh0LnR4dCIpOyAvLyDQvtGC0LrRgNGL0LvQuCDRhNCw0LnQuyDQtNC70Y8g0YfRgtC10L3QuNGPCglmb3IgKGludCBqPTA7IGo8IG47IGorKyl7CiBmb3IgKGludCBpID0wOyBpIDwgbjsgaSsrKXsKCSAJICAgICAgIGZpbiA+PiBhW2ldW2pdOwoJCSAgIGNvdXQgPDwgYVtpXVtqXSA8PCAiICI7CgkJICAgaWYgKGkgPT0gKG4tMSkpewoJCSAgIGNvdXQgPDwgZW5kbDsKCQkgICB9Cn0KCX0KCmNpbi5nZXQoKTsKfQ==