#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
int n;
cin >> n;
vector<vector<int>> a(n, vector<int> (n));
vector<int> x(2*n);
map<int,int> m;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
int cur1 = 1, cur2 = 0, elem = 0, cnt = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(i == j){
x[cur1] = a[i][j];
cur1 += 2;
m[a[i][j]]++;
if(m[a[i][j]] > cnt){
cnt = m[a[i][j]];
elem = a[i][j];
}
if(i + j == n - 1){
x[cur2] = a[i][j];
cur2 += 2;
for(auto &i : x) cout << i << " ";
cout << "\nThe most popular element is : " << elem;
using System;
class Program
{
static void Main()
{
int x1 = 2, y1 = 1;
int x2 = 6, y2 = 5;
int x3 = 10, y3 = 1;
var a = Distance(x2, y2, x3, y3);
var b = Distance(x1, y1, x3, y3);
var c = Distance(x2, y2, x1, y1);
Console.WriteLine("S = {0}", Square(a, b, c));
Console.ReadKey();
}
//растояние между точками
static double Distance(int x1, int y1, int x2, int y2)
{
return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
//формула герона
static double Square(double a, double b, double c)
{
var p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
// теорема косинусов
static double Angle(double a, double b, double c)
{
return Math.Acos((b * b + c * c - a * a) / (2 * b * c));
}
static bool IsAcuteAngel(double alpha)
{
return alpha < Math.PI / 2;
}
}
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
int n;
cin >> n;
vector<vector<int>> a(n, vector<int> (n));
vector<int> x(2*n);
map<int,int> m;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
int cur1 = 1, cur2 = 0, elem = 0, cnt = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(i == j){
x[cur1] = a[i][j];
cur1 += 2;
m[a[i][j]]++;
if(m[a[i][j]] > cnt){
cnt = m[a[i][j]];
elem = a[i][j];
}
}
if(i + j == n - 1){
x[cur2] = a[i][j];
cur2 += 2;
m[a[i][j]]++;
if(m[a[i][j]] > cnt){
cnt = m[a[i][j]];
elem = a[i][j];
}
}
}
}
for(auto &i : x) cout << i << " ";
cout << "\nThe most popular element is : " << elem;
}