#include <iostream>
using namespace std;
int n, i, j, v[100][100];
int main()
{
cout << "n= "; cin >> n;
cout << "introdu " << n*n << " numere separate prin spatiu" << endl;
cout << n << " linii cu cate " << n << " numere " << endl;
for (i=0; i<n; ++i)
{
for (j=0; j<n; ++j)
cin >> v[i][j];
}
cout << "\n Elementele de pe contur in ordinea miscarii acelor de ceasornic: \n";
for (j=0; j<n; ++j)
cout << v[0][j] << " ";
for (i=1; i<n; ++i)
cout << v[i][n-1] << " ";
for (j=n-2; j>0; --j)
cout << v[n-1][j] << " ";
for (i=n-1; i>0; --i)
cout << v[i][0] << " ";
}