#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;

#define debug(args...) (Debugger()), args
class Debugger {
   public:
    Debugger(const std::string &_separator = " => ") : first(true), separator(_separator) {}

    template <typename ObjectType>
    Debugger &operator,(const ObjectType &v) {
        if (!first)
            cerr << separator;
        cerr << v;
        first = false;
        return *this;
    }
    ~Debugger() {
        cerr << endl;
    }

   private:
    bool first;
    string separator;
};
#define debug_var(x) debug(#x, x)

template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(container) container.begin(), container.end()
#define rall(container) container.rbegin(), container.rend()
#define forin(it, container) for (auto it = container.begin(); it != container.end(); it++)
#define rforin(it, container) for (auto it = container.rbegin(); it != container.rend(); it++)

typedef long l;
typedef long long ll;
typedef pair<int, int> ipi;
typedef pair<ll, ll> lpl;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;

#define MOD 1'000'000'007

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll xpow(ll a, ll b, ll m) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            res = (res * a) % m;
        }
        a = (a * a) % m;
        b /= 2;
    }
    return res;
}

ll xmul(ll a, ll b, ll m) {
    ll res = 0;
    ll v = 1, k;
    while (b > 0) {
        if (b & 1) {
            k = (a * v) % m;
            res = (res + k) % m;
        }
        v = (v * 2) % m;
        b /= 2;
    }
    return res;
}

int main() {
    int n;
    ll ans = LONG_LONG_MAX;
    ll a, p, x;
    cin >> n;
    rep(i, 0, n) {
        cin >> a >> p >> x;
        if (x > a) {
            chmin(ans, p);
        }
    }
    cout << (ans == LONG_LONG_MAX ? -1 : ans);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rrep(i,a,b) for(ll i=a;i>=b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second
#define all(x)  x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ll INF = 1e18+10;
const ll mod = 1e9 + 7;
const ll MAXN = 6e6+100;

ll poww(ll a, ll b) {    
    if(b<0) return 0LL;
    ll ans = 1;
    while (b) {
        if (b & 1)ans = ans * a;
        a = a * a;
        b >>= 1;
    }   
    return ans;
}
ll binpow(ll a, ll b)
{
    if (b < 0) return 0LL;
    if (a <= 0)return 0LL;
    a %= mod;
    
    ll ans = 1LL;
    while (b) {
        if (b & 1)ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll modinv(ll n) {
    return binpow(n, mod - 2);
}

const ll A = 30;
ll dp[A+10][A+10];

ll recur(ll a, ll b) {
    if(dp[a][b]!=-1) return dp[a][b];
    dp[a][b] = recur(a-1,b) + recur(a,b-1);
    return dp[a][b];
}

void solve() {
    ll a,b,k; cin>>a>>b>>k;
    
    FOR(i,A+1) {
        FOR(j,A+1) dp[i][j] = -1;
    }
    dp[0][0] = 1;
    for(ll i=0; i<=A; i++) dp[i][0] = 1;
    for(ll i=0; i<=A; i++) dp[0][i] = 1;
    recur(A,A);
    
    ll rem = k, ua = a, ub = b;
    string s = "";
    while(rem>0) {
        for(ll i=ua; i>=0; i--) {
            if(dp[i][ub]<rem) {
                rem -= dp[i][ub];
                FOR(j,ua-i-1) s += 'a';
                s += 'b';
                ua = i+1; ub--; 
                break;
            }
            else if(dp[i][ub]==rem) {
                FOR(j,ua-i) s += 'a';
                FOR(j,ub) s += 'b';
                FOR(j,i) s += 'a';
                rem = 0;
                break;
            }
        }
    }
    cout<<s;
}

int main() {
    IOS; 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    //ll no_of_test_cases; cin>>no_of_test_cases; 
    ll no_of_test_cases = 1;
    //cout<<fixed<<setprecision(10);
    for(ll i=1; i<=no_of_test_cases; i++) {
        solve();
    } 
    return 0; 
}