#include <bits/stdc++.h>
using namespace std;
int main()
{
int v[9]={5, 6, 4, 3, 2, 6, 7, 9, 3};
nth_element(v, v+4, v+9);
cout << "The median is " << v[4] << '\n';
nth_element(v, v+1, v+9, greater<int>());
cout << "The second largest element is " << v[1];
}