#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define overload4(_1, _2, _3, _4, name, ...) name
#define overload3(_1, _2, _3, name, ...) name
#define rep1(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = n; i--;)
#define rrep2(i, n) for (ll i = n; i--;)
#define rrep3(i, a, b) for (ll i = b; i-- > (a);)
#define rrep4(i, a, b, c) for (ll i = (a) + ((b) - (a)-1) / (c) * (c); i >= (a); i -= c)
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define elif else if
ll beki(ll i)
{
    return 1ll < i;
}
#define skip(M) \
    if (M)      \
    continue
#define all(v) v.begin(), v.end()
#define allm(x, y, M) for (auto [(x), (y)] : (M))
#define alls(i, S) for (auto(i) : (S))
#define pb push_back
#define fi first
#define se second
#pragma warning(disable : 4312)
template <class X>
void print(X x)
{
    cout << x << endl;
}
template <class... T>
void print(T &...t)
{
    (..., (cout << t << " "));
}
void print(vl x)
{
    for (ll i : x)
    {
        cout << i << " ";
    }
    cout << endl;
}
void print(vector<PP> x)
{
    for (PP i : x)
    {
        cout << i.first << " " << i.second << endl;
    }
    cout << endl;
}
template <class X>
int lbound(X a, vector<X> &Y)
{
    return lower_bound(all(Y), a) - Y.begin();
}
template <class X>
int ubound(X a, vector<X> &Y)
{
    return upper_bound(all(Y), a) - Y.begin();
}
template <class... T>
void zero(T &...t)
{
    (..., (t = 0));
}
template <class... T>
void cl(T &...t)
{
    (..., (t.clear()));
}
template <class... T>
void in(T &...t)
{
    (..., (cin >> t));
}
template <class... T>
void put(vl &V, int n)
{
    ll k;
    rep(i, n)
    {
        cin >> k;
        V.pb(k);
    }
}
int max_index(vl &V)
{
    return max_element(all(V)) - V.begin();
}
int min_index(vl &V)
{
    return min_element(all(V)) - V.begin();
}
ll sum(vl &V)
{
    return accumulate(all(V), 0);
}
void Uni(vl &V)
{
    V.erase(unique(all(V)));
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007;
const ll MOD2 = 998244355;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, u, v, m;
ll codeforces = 1;
string S, T;
vl A, B, C, D, ANS;
vector<PP> VP, VP2;
set<ll> s;
vector<vl> g(MAX_N);
void solve()
{
    in(n);
    rep(i, n)
    {
        cin >> a >> b >> c;
        A.pb(a);
        B.pb(b);
        C.pb(c);
    }

    ans = INF;
    rep(i, n)
    {
        if (A[i] < C[i])
            ans = min(ans, B[i]);
    }

    if (ans == INF)
        print(-1);
    else
        print(ans);
}
int main()
{
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cin >> codeforces;
    while (codeforces--)
    {
        solve();
    }
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pii;

int main(){
    ll k, n, m;    cin  >> k >> n >> m;
    vector<int> a(k), b(k);
    vector<pair<double, ll>> v(k);
    rep(i, k)   cin >> a[i];
    ll sum = 0;
    rep(i, k){
        b[i] = (m*a[i])/n;
        sum += b[i];
        v[i].first = ((double)(m*a[i]))/(double)n - b[i];
        v[i].second = i;
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    rep(i, m-sum){
        b[v[i].second]++;
    }
    for(auto x : b)
        cout << x << ' ';
    cout << endl;
    return 0;
}