/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Final Contest

Solution to Ptice: https://open.kattis.com/problems/ptice
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    //Encode the answer choices and names of each person
    vector<vector<char>> ch = {{'A', 'B', 'C'}, {'B', 'A', 'B', 'C'}, {'C', 'C', 'A', 'A', 'B', 'B'}};
    vector<string> names = {"Adrian", "Bruno", "Goran"};

    //Read in the string of correct answers
    int n; string s;
    cin >> n >> s;
    
    //Find the maximum score anyone achieves
    int maxc = 0;
    vector<string> res;
    for(int i = 0; i < 3; i++) {
        int ptr = 0, score = 0;
        for(int j = 0; j < n; j++) {
            //Check if the guess matches the correct answer
            if(ch[i][ptr] == s[j]) score++;
            //Move to the next answer choice
            ptr = (ptr+1) % (ch[i].size());
        }

        //Update the list of results if the score is at least the highest
        if(score >= maxc) {
            //If this is a new high score, erase the previous names
            if(score > maxc) res.clear();
            res.push_back(names[i]);
            maxc = score;
        }
    }

    //Display the answer
    cout << maxc << endl;
    for(int i = 0; i < res.size(); i++) {
        cout << res[i] << endl;
    }
}