#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> // --> PBDS
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
const int mod = 1e9+7;
const int mod2 = 998244353;
#define what_is(x) cerr << #x << " is " << x << endl;
#define prec(n) fixed << setprecision(n)
#define inf (ll)1e18
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define trail(x) __builtin_ctzll(x) // -> number of trailing zeros
#define pll pair<ll,ll>
#define mp make_pair
#define fr first
#define sc second
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll> >
#define nl "\n"
#define lb lower_bound
#define ub upper_bound
#define oset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> // (*s.find_by_order)(s.order_of_key)(insert,erase,size,lb,ub)
/*------------------------------------------------------------------------------------------------------------*/
ll countSetBits(ll n) { ll count = 0; while (n) { count += n & 1; n >>= 1;} return count; }
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
bool powerOfTwo(ll n) { return n && (!(n & (n-1))); }
void toLower(string& s) { transform(s.begin(), s.end(), s.begin(), ::tolower); }
void toUpper(string& s) { transform(s.begin(), s.end(), s.begin(), ::toupper); }
/*************************************************************************************************************/
vector<ll> primes; // all the primes till (1e7)
vector<bool> seive(1e7+10,true);
void createSeive()
{
seive[0] = seive[1] = false;
for(int i=2;i*i<=int(1e7);++i){
if(seive[i])
{
for(int j=i*i;j<=int(1e7);j+=i) seive[j]=false;
}
}
for(int i=0;i<seive.size();++i) if(seive[i]) primes.pb(i);
}
ll binexpo(ll a, ll b, ll m) {
a %= m;
ll res = 1;
while (b > 0) {
if (b & 1)
res = (res * a) % m;
a = (a * a) % m;
b >>= 1;
}
return res;
}
ll modInverse(ll n, ll mod) // euler's totient --> eulers theorm --> fermat's
{
return binexpo(n, mod - 2, mod); // MMI of A is --> A^(mod-2) % mod
}
vector<ll>fact;
void factorial(ll n,ll mod)
{
fact.resize(n+1);
fact[0]=1;
for(int i=1;i<=n;++i) fact[i] = (fact[i-1]*i) % mod;
}
ll nCrModPFermat(ll n, ll r, ll mod) // nCr % mod calculation
{
fact.resize(n+1);
if (n < r) return 0; // If n<r, then nCr should return 0
if (r == 0) return 1; // Base case
fact[0] = 1;
for (int i = 1; i <= n; i++) fact[i] = (fact[i - 1] * i) % mod;
return (fact[n] * modInverse(fact[r], mod) % mod* modInverse(fact[n - r], mod) % mod)% mod;
}
bool isPrime(ll n)
{
// Corner case
if (n <= 1) return false;
// Check from 2 to square root of n
for (int i = 2; i*i <= n; i++)
if (n % i == 0) return false;
return true;
}
class DSU{
vector<ll> parent;
vector<ll> subtree_size;
ll N;
public:
DSU(ll n){
N = n;
parent = vector<ll>(n+1, 0);
subtree_size = vector<ll>(n+1, 1);
for(int i=1; i<=n; i++) parent[i] = i;
}
ll findRoot(ll u){
while(u != parent[u]){
parent[u] = parent[parent[u]]; //Path compression
u = parent[u];
}
return u;
}
bool combine(ll u, ll v){
ll ru = findRoot(u); // root of u
ll rv = findRoot(v); // root of v
if(ru == rv) return false; // no need to join(same group)
// small to large merging --> (union by rank or size)
if(subtree_size[ru] > subtree_size[rv]){
parent[rv] = ru;
subtree_size[ru] += subtree_size[rv];
} else{
parent[ru] = rv;
subtree_size[rv] += subtree_size[ru];
}
return true;
}
};
/********************* KMP (pattern matching)*********************/
ll kmp(string String, string pattern) {
ll i = 0, j = 0, m = pattern.length(), n = String.length();
pattern = '#' + pattern; //just shifting the pattern indices by 1
vector < ll > piTable(m + 1, 0);
for (int i = 2; i <= m; i++) {
while (j <= m && pattern[j + 1] == pattern[i])
piTable[i++] = ++j;
j = 0;
}
j = 0;
for (int i = 0; i < n; i++) {
if (pattern[j + 1] != String[i]) {
while (j != 0 && pattern[j + 1] != String[i])
j = piTable[j];
}
j++;
if (j == m) return (i - m + 1); // index of the pattern in the string
}
return -1; // not found
}
/******************************************************************/
void precompute()
{
}
void solve()
{
ll n; cin >> n;
set<pair<ll,ll>>sp;
map<ll,ll>mp;
ll k = (n * (n-1) )/2 - 1;
for (ll i = 0; i < k ; ++i)
{
ll x,y; cin >> x >> y;
mp[x]++;
sp.insert({x,y});
sp.insert({y,x});
}
set<pair<ll,ll>> sp2;
for (ll i = 1; i <=n ; ++i)
{
for (ll j = i+1; j <=n; ++j)
{
sp2.insert({i,j});
sp2.insert({j,i});
}
}
pair<ll,ll> nhihua;
ll one,second;
for(auto pr : sp2)
{
if(sp.find(pr) == sp.end())
{
one = pr.fr;
second = pr.sc;
break;
}
}
if(mp[one] > mp[second])
{
cout << one << " " << second << endl;
}else{
cout << second << " " << one << endl;
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // fast io
precompute();
int tc = 1;
// cin >> tc;
for(int t=1;t<=tc;++t)
{
//cout << "Case #" << i << ": ";
solve();
}
return 0;
}
//end
977. Squares of a Sorted Array | 852. Peak Index in a Mountain Array |
461. Hamming Distance | 1748. Sum of Unique Elements |
897. Increasing Order Search Tree | 905. Sort Array By Parity |
1351. Count Negative Numbers in a Sorted Matrix | 617. Merge Two Binary Trees |
1450. Number of Students Doing Homework at a Given Time | 700. Search in a Binary Search Tree |
590. N-ary Tree Postorder Traversal | 589. N-ary Tree Preorder Traversal |
1299. Replace Elements with Greatest Element on Right Side | 1768. Merge Strings Alternately |
561. Array Partition I | 1374. Generate a String With Characters That Have Odd Counts |
1822. Sign of the Product of an Array | 1464. Maximum Product of Two Elements in an Array |
1323. Maximum 69 Number | 832. Flipping an Image |
1295. Find Numbers with Even Number of Digits | 1704. Determine if String Halves Are Alike |
1732. Find the Highest Altitude | 709. To Lower Case |
1688. Count of Matches in Tournament | 1684. Count the Number of Consistent Strings |
1588. Sum of All Odd Length Subarrays | 1662. Check If Two String Arrays are Equivalent |
1832. Check if the Sentence Is Pangram | 1678. Goal Parser Interpretation |