#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;
using System.Collections.Generic;
using System.Linq;
namespace restless
{
class Program
static void Main()
//элементы вводятся в 1 строку
List<int> lst = new List<int>(Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray());
for (int i = 0; i < lst.Count; i++)
if (lst[i] % 2 != 0)
lst.RemoveAt(i);
Console.Write($"{lst[i]} ");
#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;
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace restless
{
class Program
{
static void Main()
{
//элементы вводятся в 1 строку
List<int> lst = new List<int>(Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray());
for (int i = 0; i < lst.Count; i++)
if (lst[i] % 2 != 0)
lst.RemoveAt(i);
for (int i = 0; i < lst.Count; i++)
Console.Write($"{lst[i]} ");
}
}
}