#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <climits>


using namespace std;


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")


#define DEBUG printf("Passing [%s] in Line %d\n" , __FUNCTION__ , __LINE__) ;
#define Fast  ios::sync_with_stdio(false);
#define REP(i, n) for (int i=0;i<n;++i)
#define FOR(i, a, b) for (int i=a;i<b;++i)
#define DWN(i, b, a) for (int i=b-1;i>=a;--i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define FOR_1(i, a, b) for (int i=a;i<=b;++i)
#define DWN_1(i, b, a) for (int i=b;i>=a;--i)
#define CLR(a, b) memset((a),(b),sizeof((a)))

#define sz(A) int((A).size())
#define pb push_back
#define fi first
#define se second

typedef long long lli;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;
typedef pair<int, int> P;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;


const int MOD = int(1e9) + 7;
const int INF = 0x3f3f3f3f;
const lli INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int MAXN = 50000 + 9;

inline int read() {
    char c = getchar();
    int x = 0, f = 1;
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

bool isPrime(int u) {
    for (int i = 2; i * i <= u; ++i) {
        if (u % i == 0) return false;
    }
    return true;
}

vi primes;

lli get(lli u) {
    lli val = 0;
    FOR(i, 0, sz(primes))if (u % primes[i] == 0) val += (1LL << i);
    return val;
}

lli calc(lli u) {
    lli val = 1;
    FOR(i, 0, sz(primes))if (u & (1LL << i)) val *= primes[i];
    return val;
}

int main() {
    Fast;
    FOR(i, 2, 51) if (isPrime(i)) primes.pb(i);
    lli ans = 1LL;
    for (auto it : primes) ans *= it;
    lli n;
    cin >> n;
    vi v(n);
    FOR(i, 0, n) cin >> v[i], v[i] = get(v[i]);
    lli sz = sz(primes);
    FOR(i, 1, 1LL << sz) {
        lli x = i;
        for (auto it : v) if (!(x & it)) x = 0;
        if (x > 0) ans = min(ans, calc(x));
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
#define ll long long

#define float double
#define sz 100005
#define all(a) a.begin(), a.end()
#define mod 1000000007
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int>>
#define debug cout << "here" << endl;
#define f(i, n) for (int i = 0; i < n; ++i)
#define pb push_back
#define ff first
#define ss second
#define pi pair<int, int>
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define p(x) cout << x << " ";
#define pe(x) cout << x << endl;
using namespace std;

// ------------------------------linked list node------------------------
class Node
{
public:
    int val;
    Node *next;

    Node(int vale)
    {
        val = vale;
        next = NULL;
    }
};
//--------------------------------linked list class ---------------------
class LL
{
public:
    Node *head;
    Node *tail;
    LL()
    {
        head = NULL;
        tail = NULL;
    }
    void insert(int data)
    {
        // cout << data << endl;
        Node *newNode = new Node(data);
        // cout << newNode->val << endl;
        if (head == NULL)
        {
            head = newNode;
            tail = newNode;
        }
        else
        {
            tail->next = newNode;
            tail = newNode;
        }
    }
};
//----------------------------TreeNode -----------------------
class TreeNode
{
public:
    int val;
    TreeNode *left;
    TreeNode *right;

    TreeNode(int x)
    {
        val = x;
        left = NULL;
        right = NULL;
    }
};
//---------------------------fast modulo exponetion ------ ---
ll pwr(ll a, ll b)
{
    a = a % mod;
    if (a == 0)
        return 0;
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a) % mod;
        }
        b = b >> 1;
        a = (a * a) % mod;
    }
    return res;
}

int main()
{
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt",
            "r", stdin);
    freopen("output.txt",
            "w", stdout);
#endif
    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {
        int n;
        cin >> n;
        vector<pair<int, string>> help(n);

        for (int i = 0; i < n; ++i)
        {
            cin >> help[i].second;
            cin >> help[i].first;
        }
        sort(help.begin(), help.end());

        cout << help[help.size() - 2].second << endl;
    }

#ifndef ONLINE_JUDGE
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif
}