p358.ans1
======================
5

=================
p358.ans2
======================
3

=================
p358.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

vector<vector<int>> a;

void read() {
    a.assign(3, vector<int>(3));
    for(int i = 0; i < 3; i++) {
        cin >> a[i];
    }
}

void solve() {
    // Sort each of the three triples, take the middle element as that triple's
    // median, then sort those three medians and print the middle one.

    vector<int> medians;
    for(int i = 0; i < 3; i++) {
        sort(a[i].begin(), a[i].end());
        medians.push_back(a[i][1]);
    }

    sort(medians.begin(), medians.end());
    cout << medians[1] << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p358.in1
======================
6 4 5
7 9 8
1 2 3

=================
p358.in2
======================
1 2 2
4 3 2
2 3 4

=================
statement.txt
======================
358. Median of Medians
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Vasya learned definition of median of three numbers. He says, "Median of three numbers is the number located in the middle when numbers are ordered in non-descending order". Subtle Pete gave him much more difficult task. Vasya has to find median of each of three triples and then find the median of three numbers he found. Please help Vasya with the task.

Input
The input file contains three lines. Each line contains three integers. Each number is not less than -1000 and is not greater than 1000.

Output
Print one number - median of three medians.

Example(s)
sample input
sample output
6 4 5 
7 9 8 
1 2 3
5

sample input
sample output
1 2 2 
4 3 2 
2 3 4
3

=================
