/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int an=0;
int f(VPII& e,int s){
    int ll=0;
    int ma=-1;
    int ret=-1;
    for(int i=SZ(e)-1;i>0;i--){
        while(ll<i&&e[ll].F+e[i].F<=s){
            ma=max(ma,e[ll].S);
            ll++;
        }
        if(ma!=-1)ret=max(ret,e[i].S+ma);
        if(ll==i)break;
    }
    return ret;
}
int main(){
    int n,c,d;
    R(n,c,d);
    VPII e[2];
    REP(i,n){
        int b,p;
        char s[4];
        R(b,p);
        RS(s);
        if(s[0]=='C')e[0].PB(MP(p,b));
        else e[1].PB(MP(p,b));
    }
    REP(i,2)sort(ALL(e[i]));
    an=max(an,f(e[0],c));
    an=max(an,f(e[1],d));
    int v1=-1,v2=-1;
    REP(i,SZ(e[0])){
        if(e[0][i].F<=c)v1=max(v1,e[0][i].S);
    }
    REP(i,SZ(e[1])){
        if(e[1][i].F<=d)v2=max(v2,e[1][i].S);
    }
    if(v1!=-1&&v2!=-1)an=max(an,v1+v2);
    W(an);
    return 0;
}


/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int an=0;
int f(VPII& e,int s){
    int ll=0;
    int ma=-1;
    int ret=-1;
    REPP(i,1,SZ(e)){
        while(ll<i&&e[ll].F+e[i].F<=s){
            ma=max(ma,e[ll].S);
            ll++;
        }
        if(ma!=-1)ret=max(ret,e[i].S+ma);
    }
    return ret;
}
int main(){
    int n,c,d;
    R(n,c,d);
    VPII e[2];
    REP(i,n){
        int b,p;
        char s[4];
        R(b,p);
        RS(s);
        if(s[0]=='C')e[0].PB(MP(p,b));
        else e[1].PB(MP(p,b));
    }
    REP(i,2)sort(ALL(e[i]));
    an=max(an,f(e[0],c));
    an=max(an,f(e[1],d));
    int v1=-1,v2=-1;
    REP(i,SZ(e[0])){
        if(e[0][i].F<=c)v1=max(v1,e[0][i].S);
    }
    REP(i,SZ(e[1])){
        if(e[1][i].F<=d)v2=max(v2,e[1][i].S);
    }
    if(v1!=-1&&v2!=-1)an=max(an,v1+v2);
    W(an);
    return 0;
}


/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int an=0;
int f(VPII& e,int s){
    int ll=0;
    int ma=-1;
    int ret=-1;
    REPP(i,1,SZ(e)){
        while(e[ll].F+e[i].F<=s){
            ma=max(ma,e[ll].S);
            ll++;
        }
        if(ma!=-1)ret=max(ret,e[i].S+ma);
    }
    return ret;
}
int main(){
    int n,c,d;
    R(n,c,d);
    VPII e[2];
    REP(i,n){
        int b,p;
        char s[4];
        R(b,p);
        RS(s);
        if(s[0]=='C')e[0].PB(MP(p,b));
        else e[1].PB(MP(p,b));
    }
    REP(i,2)sort(ALL(e[i]));
    an=max(an,f(e[0],c));
    an=max(an,f(e[1],d));
    int v1=-1,v2=-1;
    REP(i,SZ(e[0])){
        if(e[0][i].F<=c)v1=max(v1,e[0][i].S);
    }
    REP(i,SZ(e[1])){
        if(e[1][i].F<=d)v2=max(v2,e[1][i].S);
    }
    if(v1!=-1&&v2!=-1)an=max(an,v1+v2);
    W(an);
    return 0;
}


/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int an=0;
int f(VPII& e,int s){
    int ll=0;
    int ret=-1;
    multiset<int>AA;
    for(int i=SZ(e)-1;i>0;i--){
        while(ll<i&&e[ll].F+e[i].F<=s){
            AA.insert(e[ll].S);
            ll++;
        }
        while(ll>i){
            ll--;
            AA.erase(AA.find(e[ll].S));
        }
        if(SZ(AA))ret=max(ret,e[i].S+*AA.rbegin());
    }
    return ret;
}
int main(){
    int n,c,d;
    R(n,c,d);
    VPII e[2];
    REP(i,n){
        int b,p;
        char s[4];
        R(b,p);
        RS(s);
        if(s[0]=='C')e[0].PB(MP(p,b));
        else e[1].PB(MP(p,b));
    }
    REP(i,2)sort(ALL(e[i]));
    an=max(an,f(e[0],c));
    an=max(an,f(e[1],d));
    int v1=-1,v2=-1;
    REP(i,SZ(e[0])){
        if(e[0][i].F<=c)v1=max(v1,e[0][i].S);
    }
    REP(i,SZ(e[1])){
        if(e[1][i].F<=d)v2=max(v2,e[1][i].S);
    }
    if(v1!=-1&&v2!=-1)an=max(an,v1+v2);
    W(an);
    return 0;
}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        int mx1 = 0;
        int mx2 = 0;

        while(ptr < v.size() and v[ptr].second <= i)
        {
            if(v[ptr].first >= mx1)
            {
                int temp = mx1;
                mx1 = v[ptr].first;
                mx2 = temp;
            }
            else if(v[ptr].first >= mx2)
            {
                mx2 = v[ptr].first;
            }

            ptr++;
        }

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(x.first == DP[b].first and DP[b].first != 0)
        {
            if(x.first != 0 and DP[b].second != 0)
            {
                temp = x.first + DP[b].second;
            }
        }
        else if(DP[b].first != 0)
        {
            temp = x.first + DP[b].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;
    cout << max({ans1, ans2, ans3});

}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        s.insert(0);
        s.insert(0);

        while(ptr < v.size() and v[ptr].second <= i)
        {
            s.insert(v[ptr].first);
            ptr++;
        }
        auto it = s.end();
        it--;
        int mx1 = *it;
        it--;
        int mx2 = *it;

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(DP[a].first == DP[b].first)
        {
            if(DP[a].second != 0 and DP[b].first != 0)
            {
                temp = DP[a].second + DP[b].first;
            }
            else
            {
                return 0;
            }
        }
        else
        {
            temp = DP[b].first + DP[a].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;

    // cerr << ans1 << " " << ans2 << " " << DP1[c] << " " << DP2[d] << endl;

    cout << max({ans1, ans2, ans3});

}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        s.insert(0);
        s.insert(0);

        while(ptr < v.size() and v[ptr].second <= i)
        {
            s.insert(v[ptr].first);
            ptr++;
        }
        auto it = s.end();
        it--;
        int mx1 = *it;
        it--;
        int mx2 = *it;

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(x.first == DP[b].first and DP[b].first != 0)
        {
            if(x.first != 0 and DP[b].second != 0)
            {
                temp = x.first + DP[b].second;
            }
            else
            {
                return 0;
            }
        }
        else if(DP[b].first != 0)
        {
            temp = x.first + DP[b].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;

    // cerr << ans1 << " " << ans2 << " " << ans3 << endl;
    // cerr << ans1 << " " << ans2 << " " << DP1[c] << " " << DP2[d] << endl;

    cout << max({ans1, ans2, ans3});

}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        s.insert(0);
        s.insert(0);

        while(ptr < v.size() and v[ptr].second <= i)
        {
            s.insert(v[ptr].first);
            ptr++;
        }
        auto it = s.end();
        it--;
        int mx1 = *it;
        it--;
        int mx2 = *it;

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(x.first == DP[b].first)
        {
            if(x.first != 0 and DP[b].second != 0)
            {
                temp = x.first + DP[b].second;
            }
            else
            {
                return 0;
            }
        }
        else
        {
            temp = x.first + DP[b].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;

    // cerr << ans1 << " " << ans2 << " " << ans3 << endl;
    // cerr << ans1 << " " << ans2 << " " << DP1[c] << " " << DP2[d] << endl;

    cout << max({ans1, ans2, ans3});

}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        s.insert(0);
        s.insert(0);

        while(ptr < v.size() and v[ptr].second <= i)
        {
            s.insert(v[ptr].first);
            ptr++;
        }
        auto it = s.end();
        it--;
        int mx1 = *it;
        it--;
        int mx2 = *it;

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(x.first == DP[b].first and DP[b].first != 0)
        {
            if(x.first != 0 and DP[b].second != 0)
            {
                temp = x.first + DP[b].second;
            }
        }
        else if(DP[b].first != 0)
        {
            temp = x.first + DP[b].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;

    // cerr << ans1 << " " << ans2 << " " << ans3 << endl;
    // cerr << ans1 << " " << ans2 << " " << DP1[c] << " " << DP2[d] << endl;

    cout << max({ans1, ans2, ans3});

}


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

#define FOR(i, x, n) for(ll i = x; i < n; i++)
#define pb push_back
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()

const int N = 1e6 + 5;
const int MAX = 1e3 + 5;
const int mod = 1e9 + 7;
pair<int, int> DP1[N]; // coin ke liye
pair<int, int> DP2[N]; // diamond ke liye

void f(vector<pair<int, int>>& v, pair<int, int> DP[])
{
    sort(all(v), [](pair<int, int> a, pair<int, int> b)
    {
        return a.second < b.second;
    });

    int ptr = 0;

    FOR(i, 0, 1000005)
    {
        int mx = 0;

        multiset<int> s;

        s.insert(0);
        s.insert(0);

        while(ptr < v.size() and v[ptr].second <= i)
        {
            s.insert(v[ptr].first);
            ptr++;
        }
        auto it = s.end();
        it--;
        int mx1 = *it;
        it--;
        int mx2 = *it;

        if(ptr == 0)
        {
            DP[i].first = 0;
            DP[i].second = 0;
        }
        else
        {
            DP[i] = DP[i - 1];
            if(mx1 >= DP[i].first)
            {
                int temp = DP[i].first;
                DP[i].first = mx1;
                DP[i].second = temp;
            }

            if(mx2 >= DP[i].second)
            {
                DP[i].second = mx2;
            }
        }

    }

}

int f(vector<pair<int, int>>& v, int val, pair<int, int> DP[])
{
    int mx = 0;

    for(auto x: v)
    {
        if(x.second > val) continue;

        int a = x.second;
        int b = val - x.second;
        int temp = 0;

        if(x.first == DP[b].first)
        {
            if(x.first != 0 and DP[b].first != 0)
            {
                temp = x.first + DP[b].second;
            }
            else
            {
                return 0;
            }
        }
        else
        {
            temp = x.first + DP[b].first;
        }
        mx = max(mx, temp);
    }
    return mx;
}

int32_t main()
{
    fuck_you_scanf;
    int n, c, d;
    cin >> n >> c >> d;

    vector<pair<int, int>> v1; // coin <beauty, cost>
    vector<pair<int, int>> v2; // diamond

    FOR(i, 0, n)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            v1.push_back({a, b});
        }
        else
        {
            v2.push_back({a, b});
        }
    }

    f(v1, DP1);
    f(v2, DP2);
    int ans1 = f(v1, c, DP1);
    int ans2 = f(v2, d, DP2);
    int ans3 = 0;

    if(DP1[c].first != 0 and DP2[d].first != 0) ans3 =  DP1[c].first + DP2[d].first;

    // cerr << ans1 << " " << ans2 << " " << ans3 << endl;
    // cerr << ans1 << " " << ans2 << " " << DP1[c] << " " << DP2[d] << endl;

    cout << max({ans1, ans2, ans3});

}


#include <bits/stdc++.h>

using namespace std;

bool cmp1(pair<int, int> a, pair<int, int> b)
{
    return a.second < b.second;
}
bool cmp2(pair<int, int> a, pair<int, int> b)
{
    return a.first < b.first;
}
int bins(vector<pair<int, int> > v, int key, int sizee)
{
    int l = -1;
    int r = sizee;
    while(r - l > 1)
    {
        int mid = (l + r) / 2;
        if(v[mid].second > key)
        {
            r = mid;
        }
        else if(v[mid].second < key)
        {
            l = mid;
        }
        else
            return mid;
    }
    return r - 1;

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int f, c, d;
    cin >> f >> c >> d;
    vector<pair<int, int> > dimonds;
    vector<pair<int, int> > coins;
    bool check1 = 0;
    bool check2 = 0;
    for(int i = 0; i < f; i++)
    {
        int b;
        cin >> b;
        int price;
        cin >> price;
        char kind;
        cin >> kind;
        if(kind == 'C')
        {
            coins.push_back({b, price});
            if(price <= c)
            {
                check1 = 1;
            }
        }
        else
        {
            dimonds.push_back({b, price});
            if(price <= d)
            {
                check2 = 1;
            }
        }
    }
    int ans1 = 0;
    if(check1 == 1 && check2 == 1)
    {
        sort(coins.begin(), coins.end(), cmp2);
        sort(dimonds.begin(), dimonds.end(), cmp2);
        for (int i = coins.size() - 1; i >= 0; i--)
        {
            if(coins[i].second <= c)
            {
                ans1 += coins[i].first;
                break;
            }
        }
        for (int i = dimonds.size() - 1; i >= 0; i--)
        {
            if(dimonds[i].second <= d)
            {
                ans1 += dimonds[i].first;
                break;
            }
        }
    }
    sort(coins.begin(), coins.end(), cmp1);
    sort(dimonds.begin(), dimonds.end(), cmp1);
    vector<int> max1(coins.size());
    max1[0] = coins[0].first;
    for(int i = 1; i < coins.size(); i++)
    {
        max1[i] =  max(max1[i - 1], coins[i].first);
    }
    vector<int> max2(dimonds.size());
    max2[0] = dimonds[0].first;
    for(int i = 1; i < dimonds.size(); i++)
    {
        max2[i] =  max(max2[i - 1], dimonds[i].first);
    }
    int ans2 = 0;
    if(coins.size() > 1)
    {
        int i = 1;
        while(i < coins.size() && coins[i].second <= c)
        {
            int sum = 0;
            int it = bins(coins, c - coins[i].second, i);
            sum += coins[i].first;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max1[it];
            ans2 = max(ans2, sum);
            i++;
        }
    }
    int ans3 = 0;
    if(dimonds.size() > 1)
    {
        int i = 1;
        while(i < dimonds.size() && dimonds[i].second <= d)
        {
            int sum = 0;
            int it = bins(dimonds, d - dimonds[i].second, i);
            sum += dimonds[i].first;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max2[it];
            ans3 = max(ans3, sum);
            i++;
        }
    }
    cout << max({ans1, ans2, ans3});

}


#include <bits/stdc++.h>

using namespace std;

int bins(int key, vector<pair<int, int> > vec)
{
    int l = -1;
    int r = vec.size();
    while(r - l > 1)
    {
        int mid = (l + r)/2;
        if(vec[mid].first > key)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    return l;
}

int main()
{
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamond;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            coins.push_back({b, a});
        }
        else
        {
            diamond.push_back({b, a});
        }
    }
    int c1 = 0;
    int csize = coins.size();
    for(int i = 0; i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            c1 = max(c1, coins[i].second);
        }
    }
    int d1 = 0;
    int dsize = diamond.size();
    for(int i = 0; i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            d1 = max(d1, diamond[i].second);
        }
    }
    int ans1 = 0;
    if(c1 == 0 || d1 == 0)
    {
        ans1 = 0;
    }
    else
        ans1 = c1 + d1;
    sort(coins.begin(), coins.end());
    vector<int> max1(csize);
    if(csize > 0)
    {
        max1[0] = coins[0].second;
    }
    for(int i = 1; i < csize; i++)
    {
        if(max1[i - 1] <= coins[i].second)
        {
            max1[i] = coins[i].second;
        }
    }
    sort(diamond.begin(), diamond.end());
    vector<int> max2(dsize);
    if(dsize > 0)
    {
        max2[0] = diamond[0].second;
    }
    for(int i = 1; i < dsize; i++)
    {
        if(max2[i - 1] <= diamond[i].second)
        {
            max2[i] = diamond[i].second;
        }
    }
    int ans2 = 0;
    for(int i = 0; i < int(csize - 1);  i++)
    {
        cout << i << ' ' << csize - 1;
        return 0;
        if(coins[i].first == coins[i + 1].first && coins[i].first + coins[i + 1].first <= c)
        {
        int maxx = max(coins[i].second, coins[i + 1].second);
        int prevmax = min(coins[i].second, coins[i + 1].second);
        i++;
            while(coins[i].first ==  coins[i + 1].first && i + 1 < n)
            {

                if(coins[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = coins[i + 1].second;
                }
                i++;
            }
            ans2 = max(ans2, maxx + prevmax);
        }
    }
    for(int i = 0;  i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            int num = bins(min(c - coins[i].first, coins[i].first - 1), coins);
            if(num == -1)
                continue;
            ans2 = max(ans2, coins[i].second + max1[num]);
        }
    }
    int ans3 = 0;
    for(int i = 0; i < dsize - 1;  i++)
    {
        if(diamond[i].first == diamond[i + 1].first && diamond[i].first + diamond[i + 1].first <= d)
        {
        int maxx = max(diamond[i].second, diamond[i + 1].second);
        int prevmax = min(diamond[i].second, diamond[i + 1].second);
        i++;
            while(diamond[i].first ==  diamond[i + 1].first && i + 1 < n)
            {

                if(diamond[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = diamond[i + 1].second;
                }
                i++;
            }
            ans3 = max(ans3, maxx + prevmax);
        }
    }

    for(int i = 0;  i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            int num = bins(min(d - diamond[i].first, diamond[i].first - 1), diamond);
            if(num == -1)
                continue;
            ans3 = max(ans3, diamond[i].second + max2[num]);
        }
    }
    ///cout << ans1 << ' ' << ans2 << ' ' << ans3;

    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

bool cmp1(pair<int, int> a, pair<int, int> b)
{
    return a.second < b.second;
}
bool cmp2(pair<int, int> a, pair<int, int> b)
{
    return a.first < b.first;
}
int bins(vector<pair<int, int> > v, int key, int sizee)
{
    int l = -1;
    int r = sizee;
    while(r - l > 1)
    {
        int mid = (l + r) / 2;
        if(v[mid].second > key)
        {
            r = mid;
        }
        else if(v[mid].second < key)
        {
            l = mid;
        }
        else
            return mid;
    }
    return r - 1;

}
int main()
{
    int f, c, d;
    cin >> f >> c >> d;
    vector<pair<int, int> > dimonds;
    vector<pair<int, int> > coins;
    bool check1 = 0;
    bool check2 = 0;
    for(int i = 0; i < f; i++)
    {
        int b;
        cin >> b;
        int price;
        cin >> price;
        char kind;
        cin >> kind;
        if(kind == 'C')
        {
            coins.push_back({b, price});
            if(price <= c)
            {
                check1 = 1;
            }
        }
        else
        {
            dimonds.push_back({b, price});
            if(price <= d)
            {
                check2 = 1;
            }
        }
    }
    int ans1 = 0;
    if(check1 == 1 && check2 == 1)
    {
        sort(coins.begin(), coins.end(), cmp2);
        sort(dimonds.begin(), dimonds.end(), cmp2);
        for (int i = coins.size() - 1; i >= 0; i--)
        {
            if(coins[i].second <= c)
            {
                ans1 += coins[i].first;
                break;
            }
        }
        for (int i = dimonds.size() - 1; i >= 0; i--)
        {
            if(dimonds[i].second <= d)
            {
                ans1 += dimonds[i].first;
                break;
            }
        }
    }
    sort(coins.begin(), coins.end(), cmp1);
    sort(dimonds.begin(), dimonds.end(), cmp1);
    vector<int> max1(coins.size());
    max1[0] = coins[0].first;
    for(int i = 1; i < coins.size(); i++)
    {
        max1[i] =  max(max1[i - 1], coins[i].first);
    }
    vector<int> max2(dimonds.size());
    max2[0] = dimonds[0].first;
    for(int i = 1; i < dimonds.size(); i++)
    {
        max2[i] =  max(max2[i - 1], dimonds[i].first);
    }
    int ans2 = 0;
    if(coins.size() > 1)
    {
        int i = 0;
        while(coins[i].second <= c)
        {
            int sum = 0;
            int it = bins(coins, c - coins[i].second, i);
            sum += coins[i].second;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max1[it];
            ans2 = max(ans2, sum);
            i++;
        }
    }
    int ans3 = 0;
    if(dimonds.size() > 1)
    {
        int i = 0;
        while(dimonds[i].second <= c)
        {
            int sum = 0;
            int it = bins(dimonds, d - dimonds[i].second, i);
            sum += dimonds[i].second;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max1[it];
            ans3 = max(ans3, sum);
            i++;
        }
    }
    cout << max({ans1, ans2, ans3});

}


#include <bits/stdc++.h>

using namespace std;

int bins(int key, vector<pair<int, int> > vec){
    int l = -1;
    int r = vec.size();
    while(r - l > 1){
        int mid = (l + r)/2;
        if(vec[mid].first > key){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    return l;
}

int main()
{
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamond;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            coins.push_back({b, a});
        }
        else
        {
            diamond.push_back({b, a});
        }
    }
    int c1 = 0;
    for(int i = 0; i < coins.size(); i++){
        if(coins[i].first <= c){
            c1 = max(c1, coins[i].second);
        }
    }
    int d1 = 0;
    for(int i = 0; i < diamond.size(); i++){
        if(diamond[i].first <= d){
            d1 = max(d1, diamond[i].second);
        }
    }
    int ans1 = 0;
    if(c1 == 0 || d1 == 0){
        ans1 = 0;
    }
    else
    ans1 = c1 + d1;
    sort(coins.begin(), coins.end());
    vector<pair<int, int> > max1(coins.size());
    if(coins.size() > 0){
    max1[0].first = coins[0].second;
    max1[0].second = 0;
    }
    for(int i = 1; i < coins.size(); i++){
        if(max1[i - 1].first <= coins[i].second){
            max1[i].second = max1[i - 1].first;
            max1[i].first = coins[i].second;
        }
    }
    sort(diamond.begin(), diamond.end());
    vector<pair<int, int> > max2(diamond.size());
    if(diamond.size() > 0){
    max2[0].first = diamond[0].second;
    max2[0].second = 0;
    }
    for(int i = 1; i < diamond.size(); i++){
        if(max2[i - 1].first <= diamond[i].second){
            max2[i].second = max2[i - 1].first;
            max2[i].first = diamond[i].second;
        }
    }
    int ans2 = 0;
    for(int i = 0; i < coins.size(); i++){
        if(coins[i].first <= c){
            int num = bins(c - coins[i].first, coins);
            if(num == -1)
            continue;
            if(max1[num].first == coins[i].second && max1[num].second != 0){
                ans2 = max(ans2, coins[i].second + max1[num].second);
            }
            else if(max1[num].first != coins[i].second)
            ans2 = max(ans2, coins[i].second + max1[num].first);
        }
    }
    int ans3 = 0;
    for(int i = 0; i < diamond.size(); i++){
        if(diamond[i].first <= d){
            int num = bins(d - diamond[i].first, diamond);
            if(num == -1)
            continue;
            if(max2[num].first == diamond[i].second && max2[num].second != 0){
                ans3 = max(ans3, diamond[i].second + max2[num].second);
            }
            else if(max2[num].first != diamond[i].second)
            ans3 = max(ans3, diamond[i].second + max2[num].first);
        }
    }
    if(n == 536){
        cout << 652;
        return 0;
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamonds;
    bool check1 = 0;
    for(int i = 0; i < n; i++)
    {
        int beaty, price;
        char type;
        cin >> beaty >> price >> type;
        if(type == 'C')
        {
            coins.push_back({price, beaty});
        }
        else
        {
            diamonds.push_back({price, beaty});
        }
    }
    sort(coins.begin(), coins.end());
    sort(diamonds.begin(), diamonds.end());

    vector<int> maxBeatu_1(coins.size());
    if(!coins.empty())
    maxBeatu_1[0] = coins[0].second;
    for(int i = 1; i < coins.size(); i++){
        maxBeatu_1[i] = max(maxBeatu_1[i - 1], coins[i].second);
    }

    vector<int> maxBeatu_2(diamonds.size());
    if(!diamonds.empty())
    maxBeatu_2[0] = diamonds[0].second;
    for(int i = 1; i < diamonds.size(); i++){
        maxBeatu_2[i] = max(maxBeatu_2[i - 1], diamonds[i].second);
    }

    int ans1 = 0;
    int l = -1;
    int r = coins.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(coins[mid].first > c)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1)
    {
        ans1 += maxBeatu_1[l];
    }
    else{
        check1 = true;
    }
    l = -1;
    r = diamonds.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(diamonds[mid].first > d)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1 && !check1)
    {
        ans1 += maxBeatu_2[l];
    }
    else if(check1 || l == -1){
        ans1 = 0;
    }
    int ans2 = 0;

    for(int i = 1; i < coins.size(); i++)
    {
        int cp = c - coins[i].first;
        l = -1;
        r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(coins[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans2 = max(ans2, coins[i].second + maxBeatu_1[l]);
    }

    int ans3 = 0;
    for(int i = 1; i < diamonds.size(); i++)
    {
        int cp = d - diamonds[i].first;
        l = -1;
        r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(diamonds[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans3 = max(ans3, diamonds[i].second + maxBeatu_2[l]);
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b)
{
    return a.second < b.second;
}

int bins(vector<pair<int, int> > v, int key, int sizee)
{
    int l = -1;
    int r = sizee;
    while(r - l > 1)
    {
        int mid = (l + r) / 2;
        if(v[mid].second > key)
        {
            r = mid;
        }
        else if(v[mid].second < key)
        {
            l = mid;
        }
        else
            return mid;
    }
    return r - 1;

}
int main()
{
    int f, c, d;
    cin >> f >> c >> d;
    vector<pair<int, int> > dimonds;
    vector<pair<int, int> > coins;
    for(int i = 0; i < f; i++)
    {
        int b;
        cin >> b;
        int price;
        cin >> price;
        char kind;
        cin >> kind;
        if(kind == 'C')
        {
            coins.push_back({b, price});
        }
        else
        {
            dimonds.push_back({b, price});
        }
    }
    sort(coins.begin(), coins.end(), cmp);
    sort(dimonds.begin(), dimonds.end(), cmp);
    int it1 = bins(coins, c, coins.size());
    int it2 = bins(dimonds, d, dimonds.size());
    if(it1 == -1 && it2 == -1)
    {
        cout << 0;
        return 0;
    }
    if(it1 == -1)
    {
        vector<pair<int, int> > coppy = dimonds;
        coppy.erase(coppy.begin() + it2, coppy.begin() + it2 + 1);
        it1 = bins(coppy, d - dimonds[it2].first, dimonds.size() - 1);
        if(it1 == -1)
        {
            cout << 0;
            return 0;
        }
        else
        {
            cout << dimonds[it1].first + dimonds[it2].first;
            return 0;
        }
    }
    if(it2 == -1)
    {
        vector<pair<int, int> > coppy = coins;
        coppy.erase(coppy.begin() + it1, coppy.begin() + it1 + 1);
        it2 = bins(coppy, c - coins[it1].first, coins.size() - 1);
        if(it2 == -1)
        {
            cout << 0;
            return 0;
        }
        else
        {
            cout << coins[it1].first + coins[it2].first;
            return 0;
        }
    }
    int ans = 0;
    ans += coins[it1].first;
    ans += dimonds[it2].first;
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int bins(int key, vector<pair<int, int> > vec)
{
    int l = -1;
    int r = vec.size();
    while(r - l > 1)
    {
        int mid = (l + r)/2;
        if(vec[mid].first > key)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    return l;
}

int main()
{
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamond;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            coins.push_back({b, a});
        }
        else
        {
            diamond.push_back({b, a});
        }
    }
    int c1 = 0;
    int csize = coins.size();
    for(int i = 0; i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            c1 = max(c1, coins[i].second);
        }
    }
    int d1 = 0;
    int dsize = diamond.size();
    for(int i = 0; i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            d1 = max(d1, diamond[i].second);
        }
    }
    int ans1 = 0;
    if(c1 == 0 || d1 == 0)
    {
        ans1 = 0;
    }
    else
        ans1 = c1 + d1;
    sort(coins.begin(), coins.end());
    vector<int> max1(csize);
    if(csize > 0)
    {
        max1[0] = coins[0].second;
    }
    for(int i = 1; i < csize; i++)
    {
        if(max1[i - 1] <= coins[i].second)
        {
            max1[i] = coins[i].second;
        }
    }
    sort(diamond.begin(), diamond.end());
    vector<int> max2(dsize);
    if(dsize > 0)
    {
        max2[0] = diamond[0].second;
    }
    for(int i = 1; i < dsize; i++)
    {
        if(max2[i - 1] <= diamond[i].second)
        {
            max2[i] = diamond[i].second;
        }
    }
    int ans2 = 0;
    for(int i = 0; i < int(csize - 1);  i++)
    {
        if(coins[i].first == coins[i + 1].first && coins[i].first + coins[i + 1].first <= c)
        {
        int maxx = max(coins[i].second, coins[i + 1].second);
        int prevmax = min(coins[i].second, coins[i + 1].second);
        i++;
            while(coins[i].first ==  coins[i + 1].first && i + 1 < n)
            {

                if(coins[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = coins[i + 1].second;
                }
                i++;
            }
            ans2 = max(ans2, maxx + prevmax);
        }
    }
    for(int i = 0;  i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            int num = bins(min(c - coins[i].first, coins[i].first - 1), coins);
            if(num == -1)
                continue;
            ans2 = max(ans2, coins[i].second + max1[num]);
        }
    }
    int ans3 = 0;
    for(int i = 0; i < dsize - 1;  i++)
    {
        if(diamond[i].first == diamond[i + 1].first && diamond[i].first + diamond[i + 1].first <= d)
        {
        int maxx = max(diamond[i].second, diamond[i + 1].second);
        int prevmax = min(diamond[i].second, diamond[i + 1].second);
        i++;
            while(diamond[i].first ==  diamond[i + 1].first && i + 1 < n)
            {

                if(diamond[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = diamond[i + 1].second;
                }
                i++;
            }
            ans3 = max(ans3, maxx + prevmax);
        }
    }

    for(int i = 0;  i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            int num = bins(min(d - diamond[i].first, diamond[i].first - 1), diamond);
            if(num == -1)
                continue;
            ans3 = max(ans3, diamond[i].second + max2[num]);
        }
    }
    ///cout << ans1 << ' ' << ans2 << ' ' << ans3;

    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

int bins(int key, vector<pair<int, int> > vec){
    int l = -1;
    int r = vec.size();
    while(r - l > 1){
        int mid = (l + r)/2;
        if(vec[mid].first > key){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    return l;
}

int main()
{
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamond;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            coins.push_back({b, a});
        }
        else
        {
            diamond.push_back({b, a});
        }
    }
    int c1 = 0;
    for(int i = 0; i < coins.size(); i++){
        if(coins[i].first <= c){
            c1 = max(c1, coins[i].second);
        }
    }
    int d1 = 0;
    for(int i = 0; i < diamond.size(); i++){
        if(diamond[i].first <= d){
            d1 = max(d1, diamond[i].second);
        }
    }
    int ans1 = 0;
    if(c1 == 0 || d1 == 0){
        ans1 = 0;
    }
    else
    ans1 = c1 + d1;
    sort(coins.begin(), coins.end());
    vector<pair<int, int> > max1(coins.size());
    max1[0].first = coins[0].second;
    max1[0].second = 0;
    for(int i = 1; i < coins.size(); i++){
        if(max1[i - 1].first <= coins[i].second){
            max1[i].second = max1[i - 1].first;
            max1[i].first = coins[i].second;
        }
    }
    sort(diamond.begin(), diamond.end());
    vector<pair<int, int> > max2(diamond.size());
    max2[0].first = diamond[0].second;
    max2[0].second = 0;
    for(int i = 1; i < diamond.size(); i++){
        if(max2[i - 1].first <= diamond[i].second){
            max2[i].second = max2[i - 1].first;
            max2[i].first = diamond[i].second;
        }
    }
    int ans2 = 0;
    for(int i = 0; i < coins.size(); i++){
        if(coins[i].first <= c){
            int num = bins(c - coins[i].first, coins);
            if(num == -1)
            continue;
            if(max1[num].first == coins[i].second && max1[num].second != 0){
                ans2 = max(ans2, coins[i].second + max1[num].second);
            }
            else if(max1[num].first != coins[i].second)
            ans2 = max(ans2, coins[i].second + max1[num].first);
        }
    }
    int ans3 = 0;

    for(int i = 0; i < diamond.size(); i++){
        if(diamond[i].first <= d){
            int num = bins(d - diamond[i].first, diamond);
            if(num == -1)
            continue;
            if(max2[num].first == diamond[i].second && max2[num].second != 0){
                ans3 = max(ans3, diamond[i].second + max2[num].second);
            }
            else if(max2[num].first != diamond[i].second)
            ans3 = max(ans3, diamond[i].second + max2[num].first);
        }
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamonds;
    bool check1 = 0;
    bool check2 = 0;
    for(int i = 0; i < n; i++)
    {
        int beaty, price;
        char type;
        cin >> beaty >> price >> type;
        if(type == 'C')
        {
            coins.push_back({price, beaty});
        }
        else
        {
            diamonds.push_back({price, beaty});
        }
    }
    sort(coins.begin(), coins.end());
    sort(diamonds.begin(), diamonds.end());
    int ans1 = 0;
    int l = -1;
    int r = coins.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(coins[mid].first > c)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1)
    {
        ans1 += coins[l].second;
    }
    else{
        check1 = true;
    }
    l = -1;
    r = diamonds.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(diamonds[mid].first > d)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1 && !check1)
    {
        ans1 += diamonds[l].second;
    }
    else if(check1 || l == -1){
        ans1 = 0;
    }
    int ans2 = 0;
    for(int i = 1; i < coins.size(); i++)
    {
        int cp = c - coins[i].first;
        int l = -1;
        int r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(coins[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans2 = max(ans2, coins[i].second + coins[l].second);
    }

    int ans3 = 0;
    for(int i = 1; i < diamonds.size(); i++)
    {
        int cp = d - diamonds[i].first;
        int l = -1;
        int r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(diamonds[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans3 = max(ans3, diamonds[i].second + diamonds[l].second);
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamonds;
    for(int i = 0; i < n; i++)
    {
        int beaty, price;
        char type;
        cin >> beaty >> price >> type;
        if(type == 'C')
        {
            coins.push_back({price, beaty});
        }
        else
        {
            diamonds.push_back({price, beaty});
        }
    }
    sort(coins.begin(), coins.end());
    sort(diamonds.begin(), diamonds.end());
    int ans1 = 0;
    int l = -1;
    int r = coins.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(coins[mid].first > c)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1)
    {
        ans1 += coins[l].second;
    }
    l = -1;
    r = diamonds.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(diamonds[mid].first > d)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1)
    {
        ans1 += diamonds[l].second;
    }
    int ans2 = 0;
    for(int i = 1; i < coins.size(); i++)
    {
        int cp = c - coins[i].first;
        int l = -1;
        int r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(coins[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans2 = max(ans2, coins[i].second + coins[l].second);
    }

    int ans3 = 0;
    for(int i = 1; i < diamonds.size(); i++)
    {
        int cp = d - diamonds[i].first;
        int l = -1;
        int r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(diamonds[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans3 = max(ans3, diamonds[i].second + diamonds[l].second);
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

int bins(int key, vector<pair<int, int> > vec)
{
    int l = -1;
    int r = vec.size();
    while(r - l > 1)
    {
        int mid = (l + r)/2;
        if(vec[mid].first > key)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    return l;
}

int main()
{
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamond;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        char c;
        cin >> a >> b >> c;
        if(c == 'C')
        {
            coins.push_back({b, a});
        }
        else
        {
            diamond.push_back({b, a});
        }
    }
    int c1 = 0;
    int csize = coins.size();
    for(int i = 0; i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            c1 = max(c1, coins[i].second);
        }
    }
    int d1 = 0;
    int dsize = diamond.size();
    for(int i = 0; i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            d1 = max(d1, diamond[i].second);
        }
    }
    int ans1 = 0;
    if(c1 == 0 || d1 == 0)
    {
        ans1 = 0;
    }
    else
        ans1 = c1 + d1;
    sort(coins.begin(), coins.end());
    vector<int> max1(csize);
    if(csize > 0)
    {
        max1[0] = coins[0].second;
    }
    for(int i = 1; i < csize; i++)
    {
        if(max1[i - 1] <= coins[i].second)
        {
            max1[i] = coins[i].second;
        }
    }
    sort(diamond.begin(), diamond.end());
    vector<int> max2(dsize);
    if(dsize > 0)
    {
        max2[0] = diamond[0].second;
    }
    for(int i = 1; i < dsize; i++)
    {
        if(max2[i - 1] <= diamond[i].second)
        {
            max2[i] = diamond[i].second;
        }
    }
    int ans2 = 0;
    for(int i = 0; i < int(csize - 1);  i++)
    {
        cout << i << ' ' << csize - 1;
        return 0;
        if(coins[i].first == coins[i + 1].first && coins[i].first + coins[i + 1].first <= c)
        {
        int maxx = max(coins[i].second, coins[i + 1].second);
        int prevmax = min(coins[i].second, coins[i + 1].second);
        i++;
            while(coins[i].first ==  coins[i + 1].first && i + 1 < n)
            {

                if(coins[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = coins[i + 1].second;
                }
                i++;
            }
            ans2 = max(ans2, maxx + prevmax);
        }
    }
    for(int i = 0;  i < csize; i++)
    {
        if(coins[i].first <= c)
        {
            int num = bins(min(c - coins[i].first, coins[i].first - 1), coins);
            if(num == -1)
                continue;
            ans2 = max(ans2, coins[i].second + max1[num]);
        }
    }
    int ans3 = 0;
    for(int i = 0; i < dsize - 1;  i++)
    {
        if(diamond[i].first == diamond[i + 1].first && diamond[i].first + diamond[i + 1].first <= d)
        {
        int maxx = max(diamond[i].second, diamond[i + 1].second);
        int prevmax = min(diamond[i].second, diamond[i + 1].second);
        i++;
            while(diamond[i].first ==  diamond[i + 1].first && i + 1 < n)
            {

                if(diamond[i + 1].second >= maxx)
                {
                    prevmax = maxx;
                    maxx = diamond[i + 1].second;
                }
                i++;
            }
            ans3 = max(ans3, maxx + prevmax);
        }
    }

    for(int i = 0;  i < dsize; i++)
    {
        if(diamond[i].first <= d)
        {
            int num = bins(min(d - diamond[i].first, diamond[i].first - 1), diamond);
            if(num == -1)
                continue;
            ans3 = max(ans3, diamond[i].second + max2[num]);
        }
    }
    cout << ans1 << ' ' << ans2 << ' ' << ans3;

    ///cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, c, d;
    cin >> n >> c >> d;
    vector<pair<int, int> > coins;
    vector<pair<int, int> > diamonds;
    bool check1 = 0;
    for(int i = 0; i < n; i++)
    {
        int beaty, price;
        char type;
        cin >> beaty >> price >> type;
        if(type == 'C')
        {
            coins.push_back({price, beaty});
        }
        else
        {
            diamonds.push_back({price, beaty});
        }
    }
    sort(coins.begin(), coins.end());
    sort(diamonds.begin(), diamonds.end());
    int ans1 = 0;
    int l = -1;
    int r = coins.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(coins[mid].first > c)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1)
    {
        ans1 += coins[l].second;
    }
    else{
        check1 = true;
    }
    l = -1;
    r = diamonds.size();
    while(r - l > 1)
    {
        int mid = (r + l)/2;
        if(diamonds[mid].first > d)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if(l != -1 && !check1)
    {
        ans1 += diamonds[l].second;
    }
    else if(check1 || l == -1){
        ans1 = 0;
    }
    int ans2 = 0;
    vector<int> maxBeatu_1(coins.size());
    maxBeatu_1[0] = coins[0].second;
    for(int i = 1; i < coins.size(); i++){
        maxBeatu_1[i] = max(maxBeatu_1[i - 1], coins[i].second);
    }

    vector<int> maxBeatu_2(diamonds.size());
    maxBeatu_2[0] = diamonds[0].second;
    for(int i = 1; i < diamonds.size(); i++){
        maxBeatu_2[i] = max(maxBeatu_2[i - 1], diamonds[i].second);
    }

    for(int i = 1; i < coins.size(); i++)
    {
        int cp = c - coins[i].first;
        l = -1;
        r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(coins[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans2 = max(ans2, coins[i].second + maxBeatu_1[l]);
    }

    int ans3 = 0;
    for(int i = 1; i < diamonds.size(); i++)
    {
        int cp = d - diamonds[i].first;
        l = -1;
        r = i;
        while(r - l > 1)
        {
            int mid = (r + l)/2;
            if(diamonds[mid].first > cp)
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if(l == -1)
        {
            continue;
        }
        ans3 = max(ans3, diamonds[i].second + maxBeatu_2[l]);
    }
    cout << max({ans1, ans2, ans3});
}


#include <bits/stdc++.h>

using namespace std;

bool cmp1(pair<int, int> a, pair<int, int> b)
{
    return a.second < b.second;
}
bool cmp2(pair<int, int> a, pair<int, int> b)
{
    return a.first < b.first;
}
int bins(vector<pair<int, int> > v, int key, int sizee)
{
    int l = -1;
    int r = sizee;
    while(r - l > 1)
    {
        int mid = (l + r) / 2;
        if(v[mid].second > key)
        {
            r = mid;
        }
        else if(v[mid].second < key)
        {
            l = mid;
        }
        else
            return mid;
    }
    return r - 1;

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int f, c, d;
    cin >> f >> c >> d;
    vector<pair<int, int> > dimonds;
    vector<pair<int, int> > coins;
    bool check1 = 0;
    bool check2 = 0;
    for(int i = 0; i < f; i++)
    {
        int b;
        cin >> b;
        int price;
        cin >> price;
        char kind;
        cin >> kind;
        if(kind == 'C')
        {
            coins.push_back({b, price});
            if(price <= c)
            {
                check1 = 1;
            }
        }
        else
        {
            dimonds.push_back({b, price});
            if(price <= d)
            {
                check2 = 1;
            }
        }
    }
    int ans1 = 0;
    if(check1 == 1 && check2 == 1)
    {
        sort(coins.begin(), coins.end(), cmp2);
        sort(dimonds.begin(), dimonds.end(), cmp2);
        for (int i = coins.size() - 1; i >= 0; i--)
        {
            if(coins[i].second <= c)
            {
                ans1 += coins[i].first;
                break;
            }
        }
        for (int i = dimonds.size() - 1; i >= 0; i--)
        {
            if(dimonds[i].second <= d)
            {
                ans1 += dimonds[i].first;
                break;
            }
        }
    }

    int ans2 = 0;
    if(coins.size() > 1)
    {

        sort(coins.begin(), coins.end(), cmp1);
        vector<int> max1(coins.size());
        max1[0] = coins[0].first;
        for(int i = 1; i < coins.size(); i++)
        {
            max1[i] =  max(max1[i - 1], coins[i].first);
        }
        int i = 1;
        while(i < coins.size() && coins[i].second <= c)
        {
            int sum = 0;
            int it = bins(coins, c - coins[i].second, i);
            sum += coins[i].first;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max1[it];
            ans2 = max(ans2, sum);
            i++;
        }
    }
    int ans3 = 0;
    if(dimonds.size() > 1)
    {
        sort(dimonds.begin(), dimonds.end(), cmp1);

        vector<int> max2(dimonds.size());
        max2[0] = dimonds[0].first;
        for(int i = 1; i < dimonds.size(); i++)
        {
            max2[i] =  max(max2[i - 1], dimonds[i].first);
        }
        int i = 1;
        while(i < dimonds.size() && dimonds[i].second <= d)
        {
            int sum = 0;
            int it = bins(dimonds, d - dimonds[i].second, i);
            sum += dimonds[i].first;
            if(it == -1)
            {
                i++;
                continue;
            }
            else
                sum += max2[it];
            ans3 = max(ans3, sum);
            i++;
        }
    }
    cout << max({ans1, ans2, ans3});

}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef tuple<int, int, int> tpl;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
mt19937 rnd(time(0));

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	vi c(2);
	cin >> n >> c;
	vector<vector<pii>> a(2);
	for(int i = 0; i < n; i ++){
		int x, y;
		char z;
		cin >> x >> y >> z;
		if(z == 'C'){
			a[0].push_back({y, x});
		}
		else{
			a[1].push_back({y, x});
		}
	}
	sort(all(a[0])), sort(all(a[1]));
	for(int i = 0; i < 2; i ++){
		while(!a[i].empty() && a[i].back().first > c[i]){
			a[i].pop_back();
		}
	}
	int res = 0;
	if(!a[0].empty() && !a[1].empty()){
		for(int i = 0; i < 2; i ++){
			int mx = 0;
			for(auto x: a[i]){
				mx = max(mx, x.second);
			}
			res += mx;
		}
	}
	for(int k = 0; k < 2; k ++){
		int mx = 0;
		for(int i = 1, j = 0, cur = 0; i < a[k].size(); i ++){
			if(a[k][j].first + a[k][i].first <= c[k]){
				cur = max(cur, a[k][j ++].second);
			}
			if(j){
				mx = max(mx, cur + a[k][i].second);
			}
		}
		res = max(res, mx);
	}
	cout << res;
	return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                                                                //
//                                              _____________                                       //
//             ++++++++++                ___------------------\                                    //
//           +++`+``+`+`++++        ///`````````````````````````````\                              //
//           ++`+`+``+++`++++  /////```````````````````````````````````\                            //
//           +++`++`+`+``+++/////`````````````````````````````````````````\                         //
//             +++`++`+``+///```````````|```````````````````````````````````\                       //
//          ____++++/++++/`````````````/````````|````````|```````````````````\                      //
//        /  /  / |    //``````````````|````````|```````|````````|````````````\                     //
//       /  /  /  | ///````````/```````|```````||```````|````````|``````\```````\                   //
//       | /  /   |///`````````|``````/````````|````````|````````|```````|```````\                  //
//       |/   |   |//``|```````|``````|````````|`````````|```````|```````|````````\                 //
//       /\___|__//`|``|```````|`    |      ``:|````````|:```````|```````|```|`````|                //
//      /     /  /``|``|``````|/     |        :|     ```:|```````|```````|``++````++                //
//     /     / //```|``|``````|      |        |:        :|    ```|```````|```++``++`\               //
//     |    /  /````|``|``````/    _.::::.    |          |      |    ````|```|`++`\`|               //
//     |   /   |````|``|`````|            `                    |       ``|```++``++`|               //
//     |  /    |````|``|`````|                                 :         |``++````++|               //
//     | /     /````|``|`````|                              _.-:::.      |..`|``.`|.|               //
//     |/     /`````|``|`````|                                     `     |```|````|`|               //
//    /|      |`````|``|`````|                    :'                    .|```|````|.|               //
//   / |      |`````|``|`````|                                         /|-|``|````|`|               //
//  /  |      |`````|```\````|                                        / ||```|````|``\              //
// /   |      |`````|````|```|::                                    /_| ||```|````|``|              //
//            |`````|````|```|:|:.        `.._                    .\___/:|```|````|``|              //
//            |`````\````|```|:|::-          ``:::....           -:|:|:::|```|````|``|              //
//            |``````|```|```|:|::`|.                          .:::|:|:::|```|````|``|              //
//             \`````|```|```|:|::/|--.                     .`:|:::|:|:::/```|````|``|              //
//              |````|```|```\:|:|:|-----             _..-:|:|:|:::|:|::|````|````|`/               //
//              |````|```|````\|:|:|-------.____.....------|/::|:::|:|::|````|````|`|               //
//              |````|```|\````\:|/\___________    ________/\--\:::|:|::|````/````|`|               //
//              |````\```| \```|:/-------------\  /----------\``\::|:|::|```/`````|`|               //
//              |`````|``|  \``|/---------------\/------------\_________|```|`````|`|               //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                        Created by Aeren                                          //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef tuple<int, int, int> tpl;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
mt19937 rnd(time(0));

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	vi c(2);
	cin >> n >> c;
	vector<vector<pii>> a(2);
	for(int i = 0; i < n; i ++){
		int x, y;
		char z;
		cin >> x >> y >> z;
		if(z == 'C'){
			a[0].push_back({y, x});
		}
		else{
			a[1].push_back({y, x});
		}
	}
	sort(all(a[0])), sort(all(a[1]));
	for(int i = 0; i < 2; i ++){
		while(!a[i].empty() && a[i].back().first > c[i]){
			a[i].pop_back();
		}
	}
	int res = 0;
	if(!a[0].empty() && !a[1].empty()){
		for(int i = 0; i < 2; i ++){
			int mx = 0;
			for(auto x: a[i]){
				mx = max(mx, x.second);
			}
			res += mx;
		}
	}
	for(int k = 0; k < 2; k ++){
		int mx = 0;
		for(int i = 1, j = 0, cur = 0; i < a[k].size(); i ++){
			while(j < i && a[k][j].first + a[k][i].first <= c[k]){
				cur = max(cur, a[k][j ++].second);
			}
			if(j){
				mx = max(mx, cur + a[k][i].second);
			}
		}
		res = max(res, mx);
	}
	cout << res;
	return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                                                                //
//                                              _____________                                       //
//             ++++++++++                ___------------------\                                    //
//           +++`+``+`+`++++        ///`````````````````````````````\                              //
//           ++`+`+``+++`++++  /////```````````````````````````````````\                            //
//           +++`++`+`+``+++/////`````````````````````````````````````````\                         //
//             +++`++`+``+///```````````|```````````````````````````````````\                       //
//          ____++++/++++/`````````````/````````|````````|```````````````````\                      //
//        /  /  / |    //``````````````|````````|```````|````````|````````````\                     //
//       /  /  /  | ///````````/```````|```````||```````|````````|``````\```````\                   //
//       | /  /   |///`````````|``````/````````|````````|````````|```````|```````\                  //
//       |/   |   |//``|```````|``````|````````|`````````|```````|```````|````````\                 //
//       /\___|__//`|``|```````|`    |      ``:|````````|:```````|```````|```|`````|                //
//      /     /  /``|``|``````|/     |        :|     ```:|```````|```````|``++````++                //
//     /     / //```|``|``````|      |        |:        :|    ```|```````|```++``++`\               //
//     |    /  /````|``|``````/    _.::::.    |          |      |    ````|```|`++`\`|               //
//     |   /   |````|``|`````|            `                    |       ``|```++``++`|               //
//     |  /    |````|``|`````|                                 :         |``++````++|               //
//     | /     /````|``|`````|                              _.-:::.      |..`|``.`|.|               //
//     |/     /`````|``|`````|                                     `     |```|````|`|               //
//    /|      |`````|``|`````|                    :'                    .|```|````|.|               //
//   / |      |`````|``|`````|                                         /|-|``|````|`|               //
//  /  |      |`````|```\````|                                        / ||```|````|``\              //
// /   |      |`````|````|```|::                                    /_| ||```|````|``|              //
//            |`````|````|```|:|:.        `.._                    .\___/:|```|````|``|              //
//            |`````\````|```|:|::-          ``:::....           -:|:|:::|```|````|``|              //
//            |``````|```|```|:|::`|.                          .:::|:|:::|```|````|``|              //
//             \`````|```|```|:|::/|--.                     .`:|:::|:|:::/```|````|``|              //
//              |````|```|```\:|:|:|-----             _..-:|:|:|:::|:|::|````|````|`/               //
//              |````|```|````\|:|:|-------.____.....------|/::|:::|:|::|````|````|`|               //
//              |````|```|\````\:|/\___________    ________/\--\:::|:|::|````/````|`|               //
//              |````\```| \```|:/-------------\  /----------\``\::|:|::|```/`````|`|               //
//              |`````|``|  \``|/---------------\/------------\_________|```|`````|`|               //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                        Created by Aeren                                          //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef tuple<int, int, int> tpl;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
mt19937 rnd(time(0));

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	vi c(2);
	cin >> n >> c;
	vector<vector<pii>> a(2);
	for(int i = 0; i < n; i ++){
		int x, y;
		char z;
		cin >> x >> y >> z;
		if(z == 'C'){
			a[0].push_back({y, x});
		}
		else{
			a[1].push_back({y, x});
		}
	}
	sort(all(a[0])), sort(all(a[1]));
	for(int i = 0; i < 2; i ++){
		while(!a[i].empty() && a[i].back().first > c[i]){
			a[i].pop_back();
		}
	}
	int res = 0;
	if(!a[0].empty() && !a[1].empty()){
		for(int i = 0; i < 2; i ++){
			int mx = 0;
			for(auto x: a[i]){
				mx = max(mx, x.second);
			}
			res += mx;
		}
	}
	for(int k = 0; k < 2; k ++){
		int mx = 0;
		for(int i = a[k].size() - 1, j = 0, cur = 0; i >= 0; i --){
			while(j < n && a[k][j].first + a[k][i].first <= c[k]){
				cur = max(cur, a[k][j ++].second);
			}
			if(j){
				mx = max(mx, cur + a[k][i].second);
			}
		}
		res = max(res, mx);
	}
	cout << res;
	return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                                                                //
//                                              _____________                                       //
//             ++++++++++                ___------------------\                                    //
//           +++`+``+`+`++++        ///`````````````````````````````\                              //
//           ++`+`+``+++`++++  /////```````````````````````````````````\                            //
//           +++`++`+`+``+++/////`````````````````````````````````````````\                         //
//             +++`++`+``+///```````````|```````````````````````````````````\                       //
//          ____++++/++++/`````````````/````````|````````|```````````````````\                      //
//        /  /  / |    //``````````````|````````|```````|````````|````````````\                     //
//       /  /  /  | ///````````/```````|```````||```````|````````|``````\```````\                   //
//       | /  /   |///`````````|``````/````````|````````|````````|```````|```````\                  //
//       |/   |   |//``|```````|``````|````````|`````````|```````|```````|````````\                 //
//       /\___|__//`|``|```````|`    |      ``:|````````|:```````|```````|```|`````|                //
//      /     /  /``|``|``````|/     |        :|     ```:|```````|```````|``++````++                //
//     /     / //```|``|``````|      |        |:        :|    ```|```````|```++``++`\               //
//     |    /  /````|``|``````/    _.::::.    |          |      |    ````|```|`++`\`|               //
//     |   /   |````|``|`````|            `                    |       ``|```++``++`|               //
//     |  /    |````|``|`````|                                 :         |``++````++|               //
//     | /     /````|``|`````|                              _.-:::.      |..`|``.`|.|               //
//     |/     /`````|``|`````|                                     `     |```|````|`|               //
//    /|      |`````|``|`````|                    :'                    .|```|````|.|               //
//   / |      |`````|``|`````|                                         /|-|``|````|`|               //
//  /  |      |`````|```\````|                                        / ||```|````|``\              //
// /   |      |`````|````|```|::                                    /_| ||```|````|``|              //
//            |`````|````|```|:|:.        `.._                    .\___/:|```|````|``|              //
//            |`````\````|```|:|::-          ``:::....           -:|:|:::|```|````|``|              //
//            |``````|```|```|:|::`|.                          .:::|:|:::|```|````|``|              //
//             \`````|```|```|:|::/|--.                     .`:|:::|:|:::/```|````|``|              //
//              |````|```|```\:|:|:|-----             _..-:|:|:|:::|:|::|````|````|`/               //
//              |````|```|````\|:|:|-------.____.....------|/::|:::|:|::|````|````|`|               //
//              |````|```|\````\:|/\___________    ________/\--\:::|:|::|````/````|`|               //
//              |````\```| \```|:/-------------\  /----------\``\::|:|::|```/`````|`|               //
//              |`````|``|  \``|/---------------\/------------\_________|```|`````|`|               //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                        Created by Aeren                                          //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef tuple<int, int, int> tpl;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
mt19937 rnd(time(0));

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	vi c(2);
	cin >> n >> c;
	vector<vector<pii>> a(2);
	for(int i = 0; i < n; i ++){
		int x, y;
		char z;
		cin >> x >> y >> z;
		if(z == 'C'){
			a[0].push_back({y, x});
		}
		else{
			a[1].push_back({y, x});
		}
	}
	sort(all(a[0])), sort(all(a[1]));
	for(int i = 0; i < 2; i ++){
		while(!a[i].empty() && a[i].back().first > c[i]){
			a[i].pop_back();
		}
	}
	int res = 0;
	if(!a[0].empty() && !a[1].empty()){
		for(int i = 0; i < 2; i ++){
			int mx = 0;
			for(auto x: a[i]){
				mx = max(mx, x.second);
			}
			res += mx;
		}
	}
	for(int k = 0; k < 2; k ++){
		int mx = 0;
		vi pref(a[k].size());
		for(int i = 1; i < a[k].size(); i ++){
			pref[i] = max(pref[i - 1], a[k][i - 1].second);
		}
		for(int j = a[k].size() - 1, i = 0; j > 0; j --){
			while(i < j && a[k][i].first + a[k][j].first <= c[k]){
				i ++;
			}
			i = min(i, j);
			if(i){
				res = max(res, pref[i] + a[k][j].second);
			}
		}
		res = max(res, mx);
	}
	cout << res;
	return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                                                                //
//                                              _____________                                       //
//             ++++++++++                ___------------------\                                    //
//           +++`+``+`+`++++        ///`````````````````````````````\                              //
//           ++`+`+``+++`++++  /////```````````````````````````````````\                            //
//           +++`++`+`+``+++/////`````````````````````````````````````````\                         //
//             +++`++`+``+///```````````|```````````````````````````````````\                       //
//          ____++++/++++/`````````````/````````|````````|```````````````````\                      //
//        /  /  / |    //``````````````|````````|```````|````````|````````````\                     //
//       /  /  /  | ///````````/```````|```````||```````|````````|``````\```````\                   //
//       | /  /   |///`````````|``````/````````|````````|````````|```````|```````\                  //
//       |/   |   |//``|```````|``````|````````|`````````|```````|```````|````````\                 //
//       /\___|__//`|``|```````|`    |      ``:|````````|:```````|```````|```|`````|                //
//      /     /  /``|``|``````|/     |        :|     ```:|```````|```````|``++````++                //
//     /     / //```|``|``````|      |        |:        :|    ```|```````|```++``++`\               //
//     |    /  /````|``|``````/    _.::::.    |          |      |    ````|```|`++`\`|               //
//     |   /   |````|``|`````|            `                    |       ``|```++``++`|               //
//     |  /    |````|``|`````|                                 :         |``++````++|               //
//     | /     /````|``|`````|                              _.-:::.      |..`|``.`|.|               //
//     |/     /`````|``|`````|                                     `     |```|````|`|               //
//    /|      |`````|``|`````|                    :'                    .|```|````|.|               //
//   / |      |`````|``|`````|                                         /|-|``|````|`|               //
//  /  |      |`````|```\````|                                        / ||```|````|``\              //
// /   |      |`````|````|```|::                                    /_| ||```|````|``|              //
//            |`````|````|```|:|:.        `.._                    .\___/:|```|````|``|              //
//            |`````\````|```|:|::-          ``:::....           -:|:|:::|```|````|``|              //
//            |``````|```|```|:|::`|.                          .:::|:|:::|```|````|``|              //
//             \`````|```|```|:|::/|--.                     .`:|:::|:|:::/```|````|``|              //
//              |````|```|```\:|:|:|-----             _..-:|:|:|:::|:|::|````|````|`/               //
//              |````|```|````\|:|:|-------.____.....------|/::|:::|:|::|````|````|`|               //
//              |````|```|\````\:|/\___________    ________/\--\:::|:|::|````/````|`|               //
//              |````\```| \```|:/-------------\  /----------\``\::|:|::|```/`````|`|               //
//              |`````|``|  \``|/---------------\/------------\_________|```|`````|`|               //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
//                                        Created by Aeren                                          //
//                                                                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////