#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
using namespace std;

const char* options = "KPR";
char my_turn, their_turn;

#define BRAIN_SIZE 10

char stats_buffer[BRAIN_SIZE];
int counts[3];
int gains[3];

int main() {
    their_turn = 'K';
    for (int i = 0; i < BRAIN_SIZE; i++) stats_buffer[i] = '-';
    int cur = 0;

    do {
        stats_buffer[cur] = their_turn;
        cur = (cur + 1) % BRAIN_SIZE;

        // Count statistics of previous BRAIN_SIZE moves
        counts[0] = counts[1] = counts[2] = 0;
        for (int i = 0; i < BRAIN_SIZE; i++) {
            switch(stats_buffer[i]) {
               case 'K':
                  counts[0]++;
                  break;
               case 'P':
                  counts[1]++;
                  break;
               case 'R':
                  counts[2]++;
                  break;
           }
        }
        gains[0] = counts[2] - counts[1];
        gains[1] = counts[0] - counts[2];
        gains[2] = counts[1] - counts[0];
        int choice = max_element(&gains[0], &gains[0] + 3) - &gains[0];
        my_turn = options[choice];
        cout << my_turn << endl;
        cin >> their_turn;
    }
    while (their_turn != 'L');

    return 0;
}


