QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743555#5068. Prof. Pang and Pokermoonshine_sakeAC ✓68ms3892kbC++173.6kb2024-11-13 19:29:142024-11-13 19:29:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 19:29:18]
  • 评测
  • 测评结果:AC
  • 用时:68ms
  • 内存:3892kb
  • [2024-11-13 19:29:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define debug(p) for (auto i : p)cerr << i << " "; cerr << endl;
#define debugs(p) for (auto i : p)cerr << i.first << " " << i.second << endl;
typedef pair<int, int> pll;
string yes = "YES";
string no = "NO";
int get(char t)
{
    if (isdigit(t))return t - '0';
    if (t == 'T')return 10;
    if (t == 'J')return 11;
    if (t == 'Q')return 12;
    if (t == 'K')return 13;
    return 14;
}
int T;
void solve()
{
    int n, m;
    cin >> n >> m;
    deque<string>a(n);
    deque<string>b(m);
    for (int i = 0; i < n; i++)cin >> a[i];
    for (int i = 0; i < m; i++)cin >> b[i];
    string key;
    cin >> key;
    sort(a.begin(), a.end(), [&](string x, string y)
        {
            return get(x[0]) < get(y[0]);
        });
    sort(b.begin(), b.end(), [&](string x, string y)
    {
        return get(x[0]) < get(y[0]);
    });
    if(n == 1 || get(b.front()[0]) >= get(key[0]) || get(a.front()[0]) >= get(key[0]))
    {
        // if(T == 10000 - 184 && key != "3S")
        // {
        //     for (int i = 0; i < a.size(); i++)cout << a[i] << ",";
        //     cout << ";";
        //     for (int i = 0; i < b.size(); i++)cout << b[i] << ",";
        //     cout << ";" << key << endl;
        // }
        cout << "Shou" << endl;
    }
    else if(m == 1)
    {
        bool f = 0;
        for (int i = 0; i < n; i++)
        {
            if(get(a[i][0]) < get(key[0]) && get(a[i][0]) >= get(b[0][0]))
            {
                f = 1;
                break;
            }
        }
        if(f)cout << "Pang" << endl;
        else cout << "Shou" << endl;
    }
    else
    {
        if(get(b.back()[0]) >= get(key[0]))a.pop_front();
        if(b.size() >= 2 && get(b[1][0]) < get(key[0]))
        {
            cout << "Pang" << endl;
        }
        else if(get(b[0][0]) < get(key[0]))
        {
            int f = 0;
            if(get(a.back()[0]) > get(b.back()[0]))f++;
            // cout << f << endl;
            for (int i = 0; i < a.size(); i++)
            {
                // cerr << get(a[i][0]) << " " << get(b[0][0]) << " " << get(key[0]) << endl;
                if(get(a[i][0]) >= get(b[0][0]) && get(a[i][0]) < get(key[0]))
                {
                    f++;
                    break;
                }
            }
            // cout << f << endl;
            if(a.size() == 2 && n != a.size() || a.size() <= 1)f = 0;
            if(f == 2)
            {
                cout << "Pang" << endl;
            }
            else 
            {
                // if(T == 10000 - 184 && key != "3S")
                // {
                //     for (int i = 0; i < a.size(); i++)cout << a[i] << ",";
                //     cout << ";";
                //     for (int i = 0; i < b.size(); i++)cout << b[i] << ",";
                //     cout << ";" << key << endl;
                // }
                cout << "Shou" << endl;
            }
        }
        else
        {
            // if(T == 10000 - 184 && key != "3S")
            // {
            //     for (int i = 0; i < a.size(); i++)cout << a[i] << ",";
            //     cout << ";";
            //     for (int i = 0; i < b.size(); i++)cout << b[i] << ",";
            //     cout << ";" << key << endl;
            // }
            cout << "Shou" << endl;
        }
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    // int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3688kb

input:

2
2 2
2H 2D
3H 3D
4S
2 2
2H 2D
3H 4D
4S

output:

Pang
Shou

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
1 1
7C
9H
8C
1 1
7C
7D
8D
1 1
QH
KD
7H
1 1
5S
TH
QD
1 1
4C
KC
TC
1 1
JH
7D
AH
1 1
4D
QS
9S
1 1
4H
3H
3D
1 1
TH
AH
3C
1 1
JH
KS
QH

output:

Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou

result:

ok 10 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

10
1 2
QH
5C JC
KH
2 1
6H QH
3D
2H
2 2
7S 9S
4H 2H
AD
1 1
9H
KH
7C
1 1
JH
QD
4D
2 1
KH 4C
9H
KC
2 2
QC 5S
AD JD
9C
2 1
TS KC
6H
2C
1 2
KC
7C TC
3D
1 1
KH
QD
9D

output:

Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou

result:

ok 10 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

10
2 1
AD 2H
KD
QC
3 1
2H 8H QD
2D
5H
2 2
2H 3H
5D JC
6H
1 3
TH
JD 2C AC
6D
2 2
5D 2D
9C 2H
AS
2 2
KC 2S
8C 5D
TS
3 1
QH 5C 3S
KC
3H
2 1
9H 8C
7S
AH
2 3
4S 5S
TC 3D QH
KD
2 1
8D AS
AD
2H

output:

Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Shou

result:

ok 10 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

10
3 1
6S JC 4S
TH
3C
1 4
JC
AD KD 9D 4S
5D
3 3
TD AC 8D
5S JS QS
JH
4 1
QC QD AC 9D
3H
9H
1 3
JC
QH 5H 3C
5C
2 1
TS 5H
2D
3S
1 1
4H
7H
9H
4 4
6C AH 9H 9C
JC 2D 4D 2H
9S
4 4
9H 3C 4H KS
7S 2D 6D 3H
7H
4 2
2H 3C 2D 7H
8H 5C
5H

output:

Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Shou

result:

ok 10 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10
2 2
JD AH
5S TH
3D
3 2
5H TD QS
KD QH
QD
5 3
9S 6D 7H 8D 7D
6S JD QC
JC
1 3
TH
AS 2H KC
5C
2 1
2D JD
KS
7H
2 5
6C 4S
4D 4H AD 5D 9C
3D
2 2
8C QS
3D KD
3H
5 5
TH AH 7S 3H JD
JH QD 2D TD 3D
9D
5 3
8S AD TD TS AC
3C 9C TC
9H
2 3
7C 3S
6S 5C 2H
8S

output:

Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang

result:

ok 10 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10
1 6
KC
JS 4C TS 3H 8S 9C
7D
5 1
7S AC 6S KD 6C
7H
9H
6 3
2S AS QS 2C 4C 6H
7D JS TH
3C
1 5
QC
6S 2D 7H 3C 2C
8H
4 4
QD 9D 4H 9H
3C JC 3S KS
AD
3 4
9D 5C 2H
KS QH 4S QD
6S
5 2
KS 6D 9S QC 8C
9C JS
KC
2 3
2D 6H
9S TC KS
TS
6 5
KH 9H 6S 3H 7H 6C
QD 7S 5H 7C JD
9D
5 2
4D QH 3S 4S 6C
AD KC
TS

output:

Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou

result:

ok 10 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

10
3 3
6H 7D 7C
AD JH 4C
QH
3 4
8H 8D QC
KD AC 2H 9C
JC
4 3
QH 6D 7C 9H
KS JS 5H
4S
1 4
QH
JS KH AD 7D
6H
1 5
5S
5D QD 7D TC 8D
4C
7 1
QS 6H 8D KS 9C QC 9H
JS
6C
2 1
AD 7D
4C
KC
3 5
8H KS 2C
KH JS AS QD KD
5D
7 7
8C 6D 4S 7C 2S 4D 9D
5C QD TS 6H 9H 8H 6S
AS
5 3
8D 9C 2D 2C JC
TH 5D 6H
3H

output:

Pang
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou

result:

ok 10 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

10
3 2
8C 4H 8D
7H 3S
KS
5 7
2C 6C AH 7D TD
5C 3D 5H TH 6S KD TS
JS
7 5
3S 9D AD 5H 2H 4D QC
5D JC 9H 3D AH
7H
3 6
8S TD 4D
5S AS 6C 3D 5C AH
3H
3 4
AS 2D 4H
8H AD 7D 5D
KH
1 6
6C
5S 7H 2D 2S 2H QC
TC
2 4
6H 8C
7C 5S AH AD
2H
4 2
AH 2S 3H QH
3S 8H
TC
8 4
TC QD 3D KS 9S KH QS 4S
8D 9H 3C AS
4H
3 1
8D...

output:

Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang

result:

ok 10 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

10
4 7
AS 7S 9D AD
TC AC 6S 9H JC 4S JH
6C
3 3
3C 5S 5H
7H 9S JS
3H
2 2
7S 2D
TH 8H
6S
4 9
7C 6H KH AH
4D KS 4C 7H 3H 2S QS 3S 8H
KC
7 2
QS JC 4S 3D QH 5S 4C
6H KS
AH
7 7
QH QD AC 9D JH JC 6C
TC JS 4H TS 4C 2H AD
8S
4 6
5S 4D 2C 6C
QH KC AH 9D 2S 5H
7C
1 7
QH
2H 6H JH 4H AD 3S QS
9S
8 7
2D TC QH 7C ...

output:

Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang

result:

ok 10 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

10
1 9
4S
2D 2H 5C 6S AH 2S 5S 5H 8S
JS
7 3
9H 7S 4H 9D KC AH QD
JS 5H 4D
2H
9 4
TD TS 4D 2S JH 4C 9S 4S 4H
6D 5C 6S 7D
TH
10 8
3C 3S JD 2D 5C 7C QD KC 3H 2C
9H 7D 9C JS 9S 6D 4S KS
4H
5 7
6S TS QC 3C 9H
8H 7D AC 4S 8C JC JH
6C
2 9
3H 6H
5H QC 9C 5D 2S 8H QS JD AS
9D
7 9
5C JH 5S AC 7D AH AS
4D 8D 2...

output:

Shou
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou

result:

ok 10 lines

Test #12:

score: 0
Accepted
time: 3ms
memory: 3852kb

input:

10000
1 1
KH
TS
6C
1 1
JC
7C
4C
1 1
9H
QH
2C
1 1
QC
TC
5S
1 1
4S
3H
KC
1 1
5H
QD
3S
1 1
7H
6S
9H
1 1
KC
9S
4S
1 1
8C
JS
8D
1 1
QS
AC
4S
1 1
5S
KS
AC
1 1
3C
JC
AH
1 1
8D
JC
7D
1 1
6C
AD
TD
1 1
3S
6C
8D
1 1
4H
AS
4S
1 1
2C
QD
AH
1 1
4D
AD
2C
1 1
4H
8C
5S
1 1
2C
4H
AC
1 1
KD
9D
9C
1 1
8D
JD
5S
1 1
2D
A...

output:

Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
...

result:

ok 10000 lines

Test #13:

score: 0
Accepted
time: 4ms
memory: 3596kb

input:

10000
1 1
2C
QC
9D
1 1
JC
8S
AC
2 2
5C TD
6D JC
JS
2 2
2S TS
8D 4H
JS
1 1
JD
TD
5H
2 1
8D 5H
KH
2C
1 1
9D
TD
6C
2 2
QS KC
7C 2D
JC
1 1
2D
QH
4H
1 2
TS
AS JH
7D
1 2
KH
9C 9H
8S
1 2
9C
KC 7H
3H
2 2
TC 8H
3H TH
AS
1 1
4S
5C
2D
2 1
QD 8C
TD
JS
1 2
AS
KS 6C
2S
2 1
KH 2H
7C
9S
2 2
TC 7C
2C 6D
JS
2 2
AH KS...

output:

Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #14:

score: 0
Accepted
time: 6ms
memory: 3596kb

input:

10000
1 2
7S
9H 9D
KD
1 2
8S
6C 2C
TH
1 2
6C
3C KD
AC
1 2
5C
6D AS
KS
2 2
TC KD
9H AD
JH
1 3
4S
6S 5S 3D
7H
3 2
TC 3S QH
KD AC
TH
1 2
2S
QH 4H
JH
1 1
8S
5H
7S
2 2
TC 9D
JD KD
9S
1 2
JS
3S 5S
JD
3 3
5D 3C TD
TS 8H 9D
9C
2 3
TS TH
9H 5H JH
TC
1 3
3C
6D 8D 9H
4S
2 2
TH AD
5C 2D
7S
3 3
8H 5C 2D
3H 2S KH...

output:

Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou
...

result:

ok 10000 lines

Test #15:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

10000
3 2
QD 5C TD
KH TH
AH
1 1
8D
2C
9S
1 3
9D
6S AS KC
AC
1 1
4S
6H
5D
1 1
7S
3D
6C
3 4
JD 2H 3H
TH QH JC 8H
QS
1 3
3D
6D 4S 5C
KD
3 1
QS JS 3S
AC
2C
1 4
9H
4D TD 9D 5S
5C
2 4
AD 4D
8C 4H 2C JH
4C
1 2
9C
KC KH
QD
3 2
KS AD 4D
3D KH
4H
2 1
6D 2C
AC
9S
4 2
3H 6C JH JD
6S JC
KS
2 4
6H TD
JS 6S 4D KD
...

output:

Pang
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
...

result:

ok 10000 lines

Test #16:

score: 0
Accepted
time: 8ms
memory: 3588kb

input:

10000
5 4
2S 2H KH TD AC
7S 4C 3D 5D
5S
2 2
8H 4D
JH 7D
7H
2 4
7H 5S
TD 4S QS 8D
JC
1 2
TH
KS QH
3H
1 2
9C
3S AD
9S
2 5
8C 3H
KC QD 8D 7S 6S
TD
2 1
TH 8S
QD
KD
3 4
4C QD JH
9C 7D 6H 8H
4D
2 4
4D 9D
8S KC AH 6D
4H
2 5
JS TS
2D 8H AD 2C 8C
9D
5 3
7S JC JS KD 9H
JD TD 5C
TH
2 5
3H QH
JS 2D 8D 8H 5H
KS
...

output:

Pang
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Shou
...

result:

ok 10000 lines

Test #17:

score: 0
Accepted
time: 9ms
memory: 3884kb

input:

10000
3 3
6H 5H AH
TD 9C 2H
KH
1 3
7D
3D 3S TS
QS
3 5
QC QH 6H
9C 3D 8S 4S 4C
6D
3 3
6H 2D 3H
3C QH KH
AD
2 4
3S 8S
KD 2C 9S 4C
2D
2 4
6S JH
8H TS AS TD
9S
1 5
5C
2S TS AD QC 6H
8H
3 6
AS 8D KC
JD AC 8S 5C 7C 4D
5D
4 4
QC 2C 4H 5C
2S 3C AH QH
5H
2 3
JC 4C
2H KC 3D
6S
3 2
3D KC JH
7D 4C
KH
3 2
TC 7S ...

output:

Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Shou
...

result:

ok 10000 lines

Test #18:

score: 0
Accepted
time: 11ms
memory: 3840kb

input:

10000
5 7
8C AH 4D TD KC
8S TS 4H TH 7C AD 2S
AC
6 4
KS 5H JD 8C 9H 4D
AC 9S 3H JH
8H
2 3
KH 7C
9C QS 4D
KC
4 3
JH AH KC 9S
TH 8C TD
4D
7 2
2S JS 6H 5S 6C 2H AS
5C 5D
QC
6 2
9D AS 5H JC 4C JS
4S 4H
3S
4 5
3C 9C 8D KC
TC 6C 9D 5S AS
QD
6 4
2H 4C KS TD TH QH
9S QS JD 5H
5D
7 4
KD AC 7H KS 4S 5C 3C
JS ...

output:

Pang
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #19:

score: 0
Accepted
time: 12ms
memory: 3880kb

input:

10000
4 7
AH JS 4D 7C
9D AC 6C 8C 6H KS QH
QS
3 7
2D 4S QH
4C 5D QC 8H 7S TD JC
2C
5 8
KD 7S 3S 6S 4H
KS 2H JD 5C TC KH 6H 4S
TS
4 7
4S 7D KS 6C
3C AH 9D JH AC 8C 3D
9S
7 5
2S TS 3S 4S 6H QH AD
2D AC JS QD 2H
TH
3 6
5C AS KD
TC 5D 6C QS 7H AH
3S
4 5
2C 7C 9H 9C
QC 4C JS 7D 5S
4H
7 8
3C TD 3D 3H 2D 3...

output:

Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
...

result:

ok 10000 lines

Test #20:

score: 0
Accepted
time: 10ms
memory: 3596kb

input:

10000
9 4
4D 7C 5H 7D 9H TH QH 9D 3S
7S KD 3H 8H
QS
4 4
5H 2C 4S 5D
3D KC 3C TC
7D
4 2
4S 6S TH 4D
2D 4H
3C
1 8
5H
AH QS 6C 4C 8C JS QC AD
6D
6 8
6H 4C KS 9C 9S 3S
AS 7H 3C 2C JC 7C AD 5S
TD
6 4
3S 2D 3D 6D 9S AH
JC QC JS 6H
9D
7 7
KH 7C AS 7D 8D JS 3H
AH 3S JD 3C QH TC 7H
8C
8 4
9H TH 3C JH AC 3H 5...

output:

Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #21:

score: 0
Accepted
time: 14ms
memory: 3652kb

input:

10000
1 1
6C
9S
9D
5 3
5D 8S 4H TC KS
9C 6D 5C
7H
2 7
6H 7D
KD 5C 6C 5H TS 8D AH
KH
9 3
6D 6S 2D 7H AH 8C QD KS 5C
3H QC AD
2H
1 2
AC
QH 6S
KS
10 3
4C 5H 6D 8H JH JC JS 6S 7D TS
4S KH QD
8C
6 9
KH TC 7S TH 5S KS
7D 8C QD QC 6H TS 6D JS JD
3H
6 6
3S 4S 7S QD 4C JC
QH TH 9H JD TC 6H
4D
1 1
8D
2H
KH
8 ...

output:

Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
...

result:

ok 10000 lines

Test #22:

score: 0
Accepted
time: 13ms
memory: 3536kb

input:

10000
9 6
9H 5C QD 3D 6C 7S QS AS 3S
5S QH KD 7C 9S 6S
4S
7 6
8H JS 5D JD 4H 7D 3C
KD 8S 9S TS 7H 4S
AH
2 8
KD QS
AH 3C AD 5D 4S 9H 3S TS
4D
7 9
8D 2H 4H 8S 4C 9C 9D
AD 6C QS 6D 7H TH TD 2S JD
9S
2 9
8S QS
9S 3C 7C AD TC KS 5D QH JS
7S
5 3
9C KC QS 9S 9D
TD 7H 3D
2H
11 7
3D 9H QC 5H 7D AD 8D TH 2S 4...

output:

Shou
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
...

result:

ok 10000 lines

Test #23:

score: 0
Accepted
time: 18ms
memory: 3648kb

input:

10000
9 12
KD 8D KH KS 2D 2H 8C 7C TS
3H TH AH 6D 5D 9D 4S 5H 3S 8H QH 9H
AC
1 3
6S
9S JC 8D
AH
10 4
AD 3S 3H 9D JH KS 5H 7D 9S 4D
9H KH 5D JC
6D
2 9
2D AC
KH 6C AH QH 3S TS 8D QC 2H
TH
10 1
6S 2D 4S 7C 5C AH TS 8C 9D TC
9H
JC
6 3
5C AC 5D JH 6H JD
4C 9H AH
2C
10 6
8C 9S KS 9H 4D 6C AC 2S 6D TH
QC 8...

output:

Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Shou
...

result:

ok 10000 lines

Test #24:

score: 0
Accepted
time: 19ms
memory: 3656kb

input:

10000
10 5
4S 5S 3C 3H 6D 9H 2C QH 7S 8H
QD 7H QS KS JS
JC
1 2
AD
JH QH
5C
6 3
5H 5C KC 6S TH 3D
AS 7S 4H
TD
9 10
JS 2S 3C 6S AD 8S KH AS JH
3H 2D QD 7S AH JC 6H 2H 9D JD
TC
9 5
3S 3C KS 2D 5C 2H 2C 3H 7D
JH AH 6H QH QC
6D
2 4
3S 3D
8H 4D TC 5S
5D
3 7
TD 6H TC
3S 8H 9S AD 4D 2C KD
AC
10 5
6C KS QD 5...

output:

Shou
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
...

result:

ok 10000 lines

Test #25:

score: 0
Accepted
time: 21ms
memory: 3816kb

input:

10000
11 3
9D AH 4D 3H 2H 5C JS 5H 2C KC 6D
8C 6S 6C
8H
9 5
KC AD QD JH 8C AH 8S TH 6C
JS QH TC 6H 8D
AC
11 2
3C 9S 4C TH 7D TS 6H 3S 4D 3H KD
7S JS
JC
11 7
8D JC 4C 9H JS 6H 4S AC 2S 2C TS
3C 5D 4D AD AH KD 2D
TD
14 9
8H 7C KH 5S KC 8C 9H 8D 2C 3C 5D 3D 9C AS
KS AD 9D 9S 5C QD AH TS TD
3H
1 4
AC
9S...

output:

Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Pang
...

result:

ok 10000 lines

Test #26:

score: 0
Accepted
time: 22ms
memory: 3596kb

input:

10000
14 12
KC TC 5D QC 6S 2D 7C 9D AD 7H 4D QD 6C 5H
9C 9S 4S 8C 3C 3H 9H QH 4H 5S 2C AH
KS
15 12
JS 6D TC AC QC 7S TD KC 3C 2S 7H AH 5S JD 4C
9S 2D QS QH KD 7D 5D AD 2H AS KS 5H
TH
13 6
AH 5C QC 8S 2H QH 8D 7C TD 9C TS TH 9H
QS JD 6S 3D 8C 4C
3H
14 5
2S 2H 2C 7H 8C QC 5H QH TD JS 5S KH 7D JH
JD KS...

output:

Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #27:

score: 0
Accepted
time: 24ms
memory: 3592kb

input:

10000
1 2
3H
KD 8H
QD
7 16
AC QS 8S 5D JD 7H 3S
TD 7D 8D 6S TH 7C KD 8C 3D KS JH AH QC AS 9D 8H
5H
8 16
KC TC AC 8H 3S 9C 5S 3D
QC 9S 7C 4H 6C 8C 2D 6S 6H 2H 2S 3C 9H TH KD 5H
7D
3 4
JD 8H 7H
5S 7C AH 8C
KC
9 5
9D 9H 4C 7D 7C 5S 3H 4H 6H
KC 5C AD JS 6C
KH
2 2
3S KD
6D 2C
KH
8 16
8S JD 5S 2S AC 8D 2H...

output:

Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #28:

score: 0
Accepted
time: 26ms
memory: 3632kb

input:

10000
12 1
8C TD 9H TS 5C 6S 7S KH 4D AS TH 7D
6H
QD
4 1
7S 7C TS 6D
QS
9C
16 13
6D QS 5S 6H 8H TD 2D 9D 2S 8C 9C QD AC 8D JS 6S
QC KS 3S AD 5C TH 8S TC 3C AS 2H 5D 5H
AH
9 13
JH 6C AH 4D QH 9C 9S 5H 7H
3S 6S 5C 8S 4C 5S QC JS 9D TH AS KC 2D
AD
11 13
3S QD TC TS 4S 3C 5S AS 8C KD KS
5C 4D 3H TH QS 7...

output:

Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
...

result:

ok 10000 lines

Test #29:

score: 0
Accepted
time: 28ms
memory: 3892kb

input:

10000
11 8
JS 6C 9H 9C 5D JC 4S JH QH 4H TH
TS AC 8C 2C 6D 4D 2H 3C
KD
5 2
8C 9D JC 5S 9C
JS KD
AD
10 11
7H 5C 3D 9C 2S 5D 4H TD KH 7S
8C 3H 4D QH JC 6C 8H JD AC QS 9H
7D
11 18
KS TC 2C 5D 6S AC TH 5H 3H QC 3C
AD JH TS 6C QS 2H 5C QD 4S 9H 8S 9D AS AH JC TD 8C 6H
7C
14 2
KD 5C AH 8H AS 5D JH 4C 2D 5...

output:

Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #30:

score: 0
Accepted
time: 30ms
memory: 3588kb

input:

10000
13 15
2D 3D QS 9C KH 8H 4H 7C TH 9H KD 8D 5C
JD KC QH 5S JS AS QC 6C TS AD 7S 3S 4D 4C 6S
QD
14 16
2S QS JD 6H TD 8D 6S 6D 2H 5D JS QH 9C 5C
9S 4S 3S 4H TH KC 5H QD 9H 8H 3C AC 7D KS 2D 3D
9D
8 12
2D 8D TS 4D AC AD 5D 7D
6S 4C 4H TH AS TC 4S 3C 9D 2C KH 7C
9H
16 6
KS KH TS QS 3D 6D 8H TC 3S 7C...

output:

Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #31:

score: 0
Accepted
time: 32ms
memory: 3652kb

input:

10000
15 13
2H 8C 7C TD KD 5C 5H KS 5S AD 3S 9C 7H 2C JC
4S 8D 3D 2D QH KC QD KH 6S 7D 9S 9D 4H
2S
1 18
4D
3S 3H 3C 2C TC 7C KS KD 8H 4S QC 6D AD AS 9D 6H 8C JC
5S
13 16
AC 2H 7C AH 4S TD 2S AS 2C KS 4D 7S 8C
9S 8H JS KC 8D 6S 6H 3D 5S JC QC 4C JD 2D QH 9C
JH
5 12
5S 5H KD QH 3D
JH 4S KC 9H QD 8D AS...

output:

Shou
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Shou
...

result:

ok 10000 lines

Test #32:

score: 0
Accepted
time: 34ms
memory: 3596kb

input:

10000
18 10
4C 5H TD 8S 5D QC 2H 6S 2C 3S JD 9H 2S JS 4D 7H AS 6D
JH 7S QD KD KC QS 9D 4S KH 8H
2D
16 13
KC JD 3D 8H 5D AH AD AS TD 9S KD 5H 7H KH 4C QC
8S 2S 7D 9C 5S 6H JS 6C TH 7S 9H 3H TS
QH
3 11
3H 9D QH
KS 9H 7H AS 5S 7D 3D TH 8S QS 4S
6H
20 2
QS JC KD 2S TC 5D QD AH AS 9D 8C QH KH 6H TS 4C 6C...

output:

Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #33:

score: 0
Accepted
time: 36ms
memory: 3624kb

input:

10000
6 18
TH AD JD 7C KH 8S
7D TD 9C AH 8D TS 6C KC 6S 9S JC AS 4H 2S 8H 9D 2H QS
4S
6 9
5C 2C JS 6C 7C 7H
7S 3D 5H TH AC 7D KH 6D 4D
AS
2 21
TC 2S
9S 5S 9D 8H 8S 7H KH 3S KS QC QS AD 4H 7D 6C TS KC 9C AC TD QH
2C
19 14
KD 4D 4C AD JC 7D AS AC 8D QD 2H KC 3C TH 2C TC 9H 8C 6H
5D 6S 4S JH KH QS 4H 5...

output:

Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #34:

score: 0
Accepted
time: 38ms
memory: 3596kb

input:

10000
16 13
KD JH QD 7C 5S 3H 4D AD 6C 5C AS 9D JD 6S QH TC
7H 3S 6H 5H AH 2D 6D 5D TS 7S QC KC 9S
7D
2 8
JD 3H
JC 7C 5D 5H 2S 2H 8C 4D
6S
15 3
4C 4H TH 8S 8H AC JH 9C TD AS QS 2H 9S 3D JC
QH AH 5D
KD
5 23
3H 7C 6S TS KC
5C TC AC 6D 6C AD 9H 3S 3D 2H JS 5D 7S 4C 8D KD 4S AH 8S 5S 4D 7H 2C
QC
22 14
K...

output:

Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #35:

score: 0
Accepted
time: 37ms
memory: 3656kb

input:

10000
4 3
5S AS 2C 5H
9S TH QC
7C
8 23
7H 3D 6H 3S 8H 4H 9H 3C
4D 6C 8S 5S 4C QD JH 5D 7S 6D QS 9D 2S 2H 5H TD JC 8C 9C 4S 3H KH QH
QC
18 9
QC TH TC 4H QS 5S 5C 5D 7C KC 4C 8H TS KH 9H AC 3H 2H
9D 3S 8C KS 8S QH QD 2S 6S
6H
16 17
3C 2C 6S 3H 3D 4S KH 2D 8S 6C 6H JS JH 5S 7S 8H
5C 5D JD TD TS QC QS T...

output:

Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #36:

score: 0
Accepted
time: 42ms
memory: 3652kb

input:

10000
19 23
7D TD 2C 4C AS 5D 6C QS QD KC QC AD JS 3S 3D JD 6H TS 2H
TC 8H 4S 9S 4H 2S 4D 6S AH KH 5C QH KS 5S 9H 5H 3H 6D KD 8D 7H AC TH
JH
21 8
3C 2C 4S AS 6H 4D 6C QS 4C TC 3D JH 9H QH TD 5H 8S KC 2S KH JD
6S KS 3H 7S 8H 7C QC 9C
5D
1 12
8D
7S 7C 8C JH 8H 2C KC TS AD 4H 5C 3S
9C
12 13
TS 2H TH JC...

output:

Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #37:

score: 0
Accepted
time: 44ms
memory: 3876kb

input:

10000
4 25
QC 7S 5D 2H
8D QD QS KS 9H 2C KD JH 5C JC TS 6D JD 4D TH KC TC 9C 9D 8S 3H 9S KH 6C 7H
6S
15 19
5S 2S 8H KD KC JD 5H 7C 6D 2C AS 8D QS 4H JH
AH 7S JS 9H 3C 6C QC QD TH 5D TC 6H 9S KS 4D KH 4C TD 6S
4S
20 8
7D TS KH 8S KS 8C JC AS TD KC 6C 6H 7H QC 2C 3D QH 4D AC AD
QS 2D 5S AH TH 9H JS 3H...

output:

Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #38:

score: 0
Accepted
time: 45ms
memory: 3536kb

input:

10000
6 24
2H 3D 6D AC QH 9S
KD 9D 5H 7C JD TC TD AS 2S AH 6H 8D 4S 5D 3S 4C JH 3H TS QS JC QD 5C TH
KC
9 3
KC JS JH 8D 5S AC 8H TH 7C
AS AH 9C
QC
20 11
8D 5C 4D 6H TC TH 6D 2S JH 2H 4C 3D 5D QC 7S QH 2D 7C TD 7D
4S 5S 8C AH KH 2C KD AC 4H AD KS
6S
14 5
7H QH TS JD 7D 4S 8S 3C AD 6S JH 2S 6C 2D
4C 3...

output:

Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
...

result:

ok 10000 lines

Test #39:

score: 0
Accepted
time: 44ms
memory: 3600kb

input:

10000
8 4
6C KS 7H 2S 8H 3S 5C 2D
3H KH 8D JH
5H
8 20
KH 2H 3D 9S AH 7S 2D AC
TC QS 4S 4C TH 7H 5H QC JH 3S 7C 6D 4D 6H 8C KS QD 3C 4H 8H
5D
14 12
8C QD 7C 6S QC 3C 6H 4C JD 5H 7D 3S TD QS
JH 6C 9C TS 5C JC KC 2D 4S AS 5D 5S
KD
20 13
4H 5D 6D AS 2C 2D AD TH JC 3C KH KC 6H 7H 9D 4S 4D 7C 8H QS
TC 3H ...

output:

Shou
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
...

result:

ok 10000 lines

Test #40:

score: 0
Accepted
time: 49ms
memory: 3596kb

input:

10000
14 10
JS 3S TH 2S QS JH KD 3D AC 6C 6D TC 6S 9S
7H 2H 6H 7S AH KS 5D KH AD QH
8S
27 23
4C 8D AH 4D TH 9C QC 3S 9H 5C 2C AS 3D 6H KS 7H QS 6S KH 3C 5H JH 7D AC 6C TC 8C
TS 2D AD 2H 4S KD 2S 5S QH 9S 8H 5D 9D JS 7S 3H TD JD 4H 7C JC 6D KC
8S
18 1
2C 5S JH 8D TD 8C TC 5D 7C KH 8H 6D 2S 9H 3H 3D 4...

output:

Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
...

result:

ok 10000 lines

Test #41:

score: 0
Accepted
time: 46ms
memory: 3592kb

input:

10000
28 16
9C 2S 6S QD 4H 8D 7H QS 6C 2H 3H KS 7C 4D 2D 9S AC 8H 8C AH 4C KH JH 9H TH 3C 5C KD
5H 7D QH 3D AS TD 3S JC 4S JD TS 5S 6H AD 8S 6D
2C
19 23
9D TH JC 6S 8H QS 4H 3C 9C 9S JH QC 5H 8D 7H JD 5S 9H 6C
QD JS KS 3S 6D 4D KC AH 7C 8S TD 5D TS QH AS 2D KD 5C 4S 2H 3H 7D AD
2C
22 27
3C QC AS 3D ...

output:

Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #42:

score: 0
Accepted
time: 48ms
memory: 3660kb

input:

10000
28 6
AH JH 7C QH 4S 3C QD 8C 3D AD JC TC 2D 3S 9S QS TD 5H 4D 9H 2S KH 6C 5S JD 9C 4C AC
5C 8D 7D AS 5D KS
TH
1 11
JC
5C 7S 6S 7D QH JD TC 9S 4S KS 5D
JH
31 7
JH JS 9S AS 6D 8H QD KS 8S AD AC TS 9D KC 6H QC TD QS 3S 5C 3C KH 5D 7H 4C AH 5H KD 4H 3D QH
JD JC 9H 5S 2D 2C 3H
7D
23 2
2H 4C 3C 5C T...

output:

Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #43:

score: 0
Accepted
time: 53ms
memory: 3628kb

input:

10000
22 22
4C AH 8C QH QS TC 9D KS QD 5D KD 3S 7H 9H 9S KC TS 6D 6C 5S JC 2S
7S AD 5H TH JS 8D 2D 8H JH 6S 2C 3C 2H 3D 8S 4D 4S AS JD 5C 3H 7D
7C
23 5
6S 3S JD 5D 2D AS KS JC 7H 5H JS 4S 2S TH 4D AC 7C QC 6H 2C 7D 7S TS
4H 6D 3D 2H 5C
TD
1 12
5S
4H QS 2S 4D KD 2D 7S JD 6D JC 4C 2H
9H
3 30
6S AS 7C
...

output:

Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
...

result:

ok 10000 lines

Test #44:

score: 0
Accepted
time: 54ms
memory: 3592kb

input:

10000
24 16
9S TC 9D AH 3C 6S 6H 2D 8D 3H 8S JC 2S 2H KH 4C TD AD 8C 8H JS KC 7H 5S
4D AC QC 5D 3S KD 7C 7D AS TH 9C 4H 7S 3D 2C 5H
JH
7 12
KC TC JS 6D QD AD KS
TS 8D 3H 7C AH 9D 6C 6S AS TH 5S JC
JH
21 1
6S 8D AS KD 2C 5C QH 8H 2H KS 2D 5S 9C 4H 2S 3D JS QD 9H 5D QC
AH
JH
15 19
KS 3C 2S JD TH 5H 7H...

output:

Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #45:

score: 0
Accepted
time: 56ms
memory: 3880kb

input:

10000
14 34
KD 7D QD 9H JD KS 3H TD 5H 8H 6S 3S 6C AC
7C 6D 2S JH JS QC TC 2C 4S AD 5C QS AS 4H 3D TH 3C AH QH TS 9D KH 5D 2D 8C 5S 9C 6H 4C 8S 2H 9S 7S 8D
4D
5 19
QC 2D 5C 2S 4C
JC JD 5D 9D 3H AS 2H KH 5H 5S 3S KS AD 6S KD 7H AH 7S QH
KC
7 6
9H 2H KD 9S 8S TD 5S
6C 6H 4D 8H QH JC
KC
19 16
KH 7S AH ...

output:

Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #46:

score: 0
Accepted
time: 56ms
memory: 3656kb

input:

10000
27 17
3S 3C KH 9H 3D 8H 8D KC QH 2D 4S QS JD AS KS 8S 9D 8C 2S 7D 7H JH 4H AD JS 7C JC
TH TD 4D 7S 3H 9C QD 5H 6D AC 9S KD 2C 2H AH 5D 4C
6C
12 16
8S AS QS 5D 9C 2H KH AD 3S 4H 4D TD
2C 7S TS 6D 4C QD 5S 5C 6S 9H KC KD AH 7H AC QC
2D
21 26
QS AS 9C 5H 3C 9H 2D AC 5C TS JH QC AH KH 4D 6H 7H 8C ...

output:

Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #47:

score: 0
Accepted
time: 58ms
memory: 3592kb

input:

10000
30 7
8H KH 2C 9H 7H 3D 2D 4H 9S JH 3S 3H 6H KD 5S 9C TS 4S KS 2H 4D 5H 8D 7D AS 5C TH QH 6D JS
8C 7C 7S 6C 2S KC AC
AH
21 30
TD 4S JS 3C 6S AD 9D KS QD QC AC 6H TH TS 2S 3H JC JH KC 7S 5S
9C 4H JD 7D 2C KH 7H 4D 3D QS AS 4C 5H 6D 2H 3S 8S 7C 2D TC 6C 5C 9S 9H AH QH KD 5D 8C 8H
8D
31 1
9H 6D TH...

output:

Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #48:

score: 0
Accepted
time: 55ms
memory: 3592kb

input:

10000
17 5
TC 3H 3C 9S 3S JC AC QS 6S 5H KD KS JS 9C QD AH 9D
7H 6H 7D 2S QC
JH
9 36
2S 2D KH 5C AC 9H 3C 6C QH
2H QS KD KS 6S 4H 5S JH JC 8D 7D 4S JS AS TD 2C 7H AD QC 4D 3D JD 3H 8S 4C QD 5D AH 6D TS 9D 8C 6H KC 7C 7S
8H
23 4
9D 4D 8D TH 7C JC 4H AS 9H QC 2D KC 2C KS TC 9C 9S 3S QS 5H AC 6S 4C
JS ...

output:

Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #49:

score: 0
Accepted
time: 59ms
memory: 3652kb

input:

10000
25 12
3H QD 5D 6H 2C 8D 4C 5H 4S 3D 9C AC 5C 8H 2H JC TS KD 6S 2D 7H 8S AH JH 5S
TD AD JS 9D 3S QS 3C KH 4D TC JD 7D
KC
25 8
4S 9C 7H AH 8S 9D KD QS 7D 8H KS AD QD 4D 3S 5S 2C 3D TC 9S 8D 6D 3C QC JH
6C AC 5D QH 2H JC 4C KH
2S
2 24
TD 6S
3C TH 4D JH 8C AD 4C 3S 5S 6C 6H AH KS KH QD 8D 3D JS 2C...

output:

Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #50:

score: 0
Accepted
time: 61ms
memory: 3816kb

input:

10000
36 11
6D 9H 8D 6H 2C 5S KS 6S QC 8H 7C 3S TD JS 4S 7H JC KC 8S 6C 4D TS 2H 5C AS TH 3D 4C AD 7S 2S TC QS 5H AH 2D
9C QH KH JH 4H QD 9D AC 7D JD 9S
3H
23 5
8D JD 3C AH 3H QS TD 2S 2D KS 7H 4H 6C QC 9C AC JC 5S 9S 4C 2C 7D 7C
KH 6S 6H 5H QH
AD
11 4
5H 2C 6D 5C 8S 4H 2D 6S 3H 7D 8H
7S TC KH 8D
AC...

output:

Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
...

result:

ok 10000 lines

Test #51:

score: 0
Accepted
time: 61ms
memory: 3884kb

input:

10000
33 5
5D AD 3S 4C JS 2H 9S AC 7D 4S 2D QD 8H KD QH AH 5H 9C 2C KH 3C 8C KS 2S 7C JC 8D TS 6C 3D 4D TD QC
9H 7S 4H JH QS
5C
16 33
4H TH 6D AD 9H 6C JC QD 7S 4C KD 2S 4S KH 8D KS
2C 5D 9D 3S AH TC 5C 9C 3C QC 2D QH 6H TD 5S 3H JS AC 2H JD 9S JH 7C 8S AS 3D 6S 5H 8C 7H 8H KC 4D
TS
23 13
3H 7C QS 2...

output:

Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #52:

score: 0
Accepted
time: 62ms
memory: 3596kb

input:

10000
1 6
TC
JS 6S 6C 2C 9H 3S
2S
7 41
JS 9S 4D 2S TD 4H JH
7C 8S 7S 3D JD 9C AS KC 3C QS JC 8C 9D 3H 3S 6H 8D 9H AD 6S 2C QD 2H TS KH 5H 4S TH 5C 8H 2D 7D 4C KS QH 6C KD AH 7H 6D 5D
5S
27 22
5S KC AC AH 4C KH 4H 5D 5C 7S JD 8C 7H 3C 4S QH JC AD 6C AS JS 2D 6S 3D 6D TS 7C
KS JH 3H 5H 8H TD 9C TH 6H ...

output:

Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #53:

score: 0
Accepted
time: 63ms
memory: 3628kb

input:

10000
11 37
KH 7D 6S 4H TD 3H JH 2C AC 3S JS
AS 7C QC QS 6D 5H 8S 4D 7H 6H 9H QH KC 2H KD AD AH 3C TH 2S 7S TS 6C JD 2D TC 4S KS 5D 8C 3D 9S 9D 4C 5S 5C 8H
9C
13 6
8C QC 4D KS 5S TD 4H 2D 9D 7S 5D JC 4S
3D 7H 9C 8H QS 5H
JD
2 26
KS 8D
2H 7S TS 5S 8S 5H 3D AC 2D 6S KD QC 6D 7H 3S QD QS 5C JS 9S 5D 8H...

output:

Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #54:

score: 0
Accepted
time: 64ms
memory: 3652kb

input:

10000
19 26
4C 4S 7C 4H 2D JD 8H 7H 9H QS QC 3C 6D 9C TC 8S AC QH 6C
AS QD 2H TH 4D JH KC 7D 8C TS 2S 6H 5H 3H 2C 9D 5C JC TD 8D KH 9S 6S JS 3S AD
3D
20 23
3S 9D QH 4C 9C TD AH AC 2C 5S 3H TC QS 4H 7S 4S 2H 8C 6S 7H
6D 5C KH 7C KC QC 5H JD 7D 8D 8S TS 6C 5D 2S TH 3D 4D AD 8H QD KS JH
6H
24 8
JC 3C 9...

output:

Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #55:

score: 0
Accepted
time: 64ms
memory: 3632kb

input:

10000
17 20
7S AC TC KC 6H 6C 2S 3C AD 5C 7H 2H QH 8H JS KH 5H
6D QS AS 9S 4S 3D 8S 6S JC 7C 2C 4C QD 5S 4H QC 9H TD JD 9D
4D
9 16
5C AD QH 6D QS 2H 5H 2S JD
3H AS 7C JC JS QC 9S 9D 4C 2C 3D AH 4H TC 8S 5D
8H
12 6
QC AC 4D AD 8H 7S 9C TS 7C JD 9D JC
QH TC TH JH 9H AH
9S
4 20
7H 3H KD 9H
6D 2D 4H TS ...

output:

Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #56:

score: 0
Accepted
time: 65ms
memory: 3888kb

input:

10000
7 22
QD 3C JD KC TS 2S TD
4D 4S QC 4H 3S 6S 6C 8S 2H 4C 7D 8D 9D 6H 5S 7C 3H 7H AH TH 3D 5D
9S
45 4
JD 6C 3S 7H 5D AC 7C 2C 8S 7D TD 4C 7S 3C QS AH KD 5H QD 5C 9C 4S 6H 5S 3H TC KC 3D 4D 9H 9S JC AD AS KH QH 6D 8D 2S QC 8C JH 4H KS 6S
8H TS 9D TH
JS
6 14
TH 2H 4C 4H TD 5C
TC 3C QD QC 2S TS AH ...

output:

Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
...

result:

ok 10000 lines

Test #57:

score: 0
Accepted
time: 66ms
memory: 3540kb

input:

10000
23 3
2S QC QD KC 6S 9S 4H 8C TC 5S 2H 3D 6C 5H 8H 7H KH KS AC 6D QS 4C 8S
JC 2D 9C
7C
16 22
5C JD TS 5H KS 4D TH AD JS AC 6C TC 5S 2H 8C 6H
7H 9H 8H QC 2D KC QH 6D 8D 3S 9C JH JC AH 3C QD 4H 7C 7S 2C 3D 9S
TD
14 17
TC 2S 2D QC KC 6H 8H 3S JH 8C 5S AC 4H 8D
9H 8S 7H AS JD 5D 7C TS 2C 6S 7S 5C A...

output:

Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Shou
...

result:

ok 10000 lines

Test #58:

score: 0
Accepted
time: 67ms
memory: 3584kb

input:

10000
37 9
7H 9D AH TC 9C 5D AD 2S 7C 3S JS 4S 7D 6S 5H AC 4C JD 6H KC 9S KD 8H 3H 3C 9H 7S QH 2D 4H 5C 8S KS 2H 4D QS JC
3D 8D 6C KH AS JH QC 2C 6D
TH
6 41
3D 4H QH AD 4S TD
AH KD QS 5H 8D 8H 8C 4C AC 9D QD 2C 9C JC 6H 4D 2D JS 3C QC 9H TS 7S JH 2H KH 7D 3H KC 5D TC 6C 6D TH KS 9S 8S 6S 3S 5C 5S
7C...

output:

Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Pang
...

result:

ok 10000 lines

Test #59:

score: 0
Accepted
time: 67ms
memory: 3652kb

input:

10000
33 10
JC 6S 2C TC 5D JH 6D 9C 3C 7C JS 3D 6H 4D 6C TD 4H 7H 8H KC AC QH 5S 9S 9H QD 8S KS 3S 2D JD 4C 3H
AH 2H 8D 5C KH 4S 2S 7S 9D QS
AS
6 39
6H AS 7C AH 3H 5H
9C TH 8H KH TS 3C 3S 6C 4C 3D 5S QD 4H 4D 8C 9S 4S TD KC 8S 2C JH 2S 5D 9D 2H 7D KD KS JD QS 8D 7S 7H AD 6S 2D QH TC
6D
22 5
AS 2H JD...

output:

Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Shou
Shou
Shou
Pang
...

result:

ok 10000 lines

Test #60:

score: 0
Accepted
time: 68ms
memory: 3852kb

input:

10000
31 12
2H 8C 5D 8H 9H 6D 3H TD JD 6S 9S 4H JS KH 2D TC 2C AC QD 9C 3D 7S QC 5H 7D 5C TH 4S TS AH QH
3S 7H 2S 3C KD 9D 6H KC 6C 8D 5S 4D
AD
21 2
AC 7H TS QC AS 6C KH 8D QS 7C 8H JS KD 4S 5S 9H 3C 9C 6S AH 2D
JC 5C
TC
9 18
AD 3H 9D 8S JS 6S 3C 5C 9H
JC KC 4D 7S 5S 6D 7C 3D 2C QS 3S JH TH 9S KD TS...

output:

Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
...

result:

ok 10000 lines

Test #61:

score: 0
Accepted
time: 68ms
memory: 3628kb

input:

10000
14 21
2S 7C KC JD KD 5H KS 8S 9H QH 3C 3D 2D 8H
7S KH 6D AS 7H 3S 2C JH 4C 8C 5S 6S 4D JC 4S AC 6C QC 8D AD QD
TH
45 6
AD 8D JH JD TS AC 6D 6S 5S AS QC JC 6H 3S TC 3C 4D 2C 7H 3H 4C 7S 4H 7D 9C TD JS KD 7C 5H TH 2S QS 9S 2H KS 5C 9D 6C KH 4S QH 2D 8C 8S
QD 8H KC 5D 9H 3D
AH
5 15
QH 7H 7C 6D 4S...

output:

Pang
Pang
Shou
Pang
Shou
Shou
Pang
Pang
Shou
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Shou
Shou
Shou
Pang
Pang
Pang
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Pang
Shou
Shou
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Pang
Pang
Pang
Pang
Pang
Shou
Pang
Pang
Shou
Pang
...

result:

ok 10000 lines