#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define mod9 1000000009
#define fast                       \
    ios_base ::sync_with_stdio(0); \
    cin.tie(NULL);                 \
    cout.tie(NULL);
#define mp make_pair
#define pb push_back
#define ct    \
    ll t;     \
    cin >> t; \
    while (t--)
#define bi begin()
#define ei end()
#define fi first
#define se second
#define foe(i, a, b) for (ll i = a; i < b; i++)
#define rfoe(i, a, b) for (ll i = a; i >= 0; i--)
#define sz(s) (ll) s.size()
#define mem(a, s) memset(a, s, sizeof(a))
#define all(v) v.bi, v.ei
#define MAX 8000000000000000064LL
#define MIN -8000000000000000064LL

typedef pair<ll, ll> pii;

ll add(ll a, ll b) { return (a % MOD + b % MOD + ((MAX) / MOD) * MOD) % MOD; }
ll sub(ll a, ll b) { return (a % MOD - b % MOD + ((MAX) / MOD) * MOD) % MOD; }
ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD) + ((MAX) / MOD) * MOD) % MOD; }
long long binpow(long long a, long long b)
{
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }
// ll fact[1000007 ]={0};
// ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
// y=y>>1;x=(1ll*x*x)%MOD;} return res;}
// void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
// ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
// ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
int const N = 1e3 + 9;
ll const INF = 2e9 + 5;
ll dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
ll dy[8] = {1, -1, 0, 0, -1, 1, -1, 1};
char dr[4] = {'R', 'L', 'D', 'U'};
ll n, c, ans = INF, a[25];
void go(ll x, ll xr)
{
    if (x == n)
    {
        ans = min(ans, xr);
        return;
    }

    ll orr = 0;
    foe(i, x, n)
    {
        orr |= a[i];
        go(i + 1, xr ^ orr);
    }
}
void solve()
{
    cin >> n;
    ll dp[32];
    mem(dp, 0);
    foe(i, 0, n)
    {
        cin >> a[i];
    }
    go(0, 0);
    cout << ans << "\n";
}
int main()
{
    fast
    // facto();
    // Sieve();
    // ct
    {
        solve();
    }
}
#include <bits/stdc++.h>

#define rep( i, a, b ) for( i = a; i < b; i ++ )

using namespace std;

struct sc {
    int t;
    int am;

    public:
    bool operator>( const sc &r ) const {
        return t == r.t ? am > r.am : t > r.t;
    }
};

int main() {
    int le, li, u, am, f, t, i;
    priority_queue< sc, vector< sc >, greater< sc > > scq;
    cin >> le >> li;
    rep( i, 0, le ) {
        cin >> f >> t >> am;
        scq.push( { f, am } );
        scq.push( { t, -am } );
    }
    while( ! scq.empty() ) {
        li -= scq.top().am;
        if( li < 0 ) {
            cout << "No" << endl;
            return 0;
        }
        scq.pop();
    }
    cout << "Yes" << endl;
    return 0;
}