//https://atcoder.jp/contests/abc183/tasks/abc183_d
//D - Water Heater
#include <bits/stdc++.h>
 
using namespace std;
 
const int MAXN=2e5+4;
long long nums[MAXN];
 
int main() {
#if 1
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
 
    int n,w;
    cin>>n>>w;
    for (int i=1; i<=n; i++) {
        int s,t,p;
        cin>>s>>t>>p;
 
        nums[s] += p;
        nums[t] -= p;
    }
 
    for (int i=1; i<MAXN; i++) {
        nums[i] += nums[i-1];
    }
 
    for (int i=0; i<MAXN; i++) {
        if (nums[i]>w) {
            cout<<"No\n";
            return 0;
        }
    }
 
    cout<<"Yes\n";
    return 0;
}
# include <bits/stdc++.h>
using namespace std;
 
# define fori(i,n)          for(int i=0;i<n;i++)
# define forl(i,n)          for (ll i=0;i<n;i++)
# define pb                 push_back
# define mp                 make_pair
# define X                  first
# define Y                  second
# define all(v)             v.begin(),v.end()
# define sz(a)              int((a).size())
# define in_ar_int(arr,n)   int arr[n]; fori(i,n) cin >> arr[i];
# define in_ar_ll(arr,n)    ll arr[n]; fori(i,n) cin >> arr[i];
# define endl               "\n"
# define R0                 return 0
# define mod                1000000007
# define pi                 3.1415926536
# define fill(a,x)          memset(a,x,sizeof(a))
 
typedef long long ll;
typedef string str;
typedef unsigned long long ull; 
typedef pair<int, int> pii; 
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef map <int,int>  mii;
 
 
void solve(){
    int n; cin >> n;
    str s; cin >> s;
    int q; cin >> q;
    int flag=0;
    while (q--){
        int a,b,c; cin >> a >> b >> c;
        if (a==1){
            b=b-1;
            c=c-1;
            if (flag==1){
                b=(b+n)%(2*n);
                c=(c+n)%(2*n);
            }
            int tmp=s[b];
            s[b]=s[c];
            s[c]=tmp;
        }else{
           flag=1-flag;
        }
    }
    if (flag==0) cout << s;
    else{
        for (int i=n;i<2*n;i++){
            cout << s[i];
        }
        for (int i=0;i<n;i++){
            cout << s[i];
        }
    }
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int chill=1;
    // cin >> chill;
    while(chill--){
    solve();
    }
}