#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool srt(pair<int, int> a, pair<int, int> b)
{
return a.second > b.second;
}
vector<int> solution(vector<int> answers)
{
vector<int> answer;
vector<pair<int, int> > stu = { {1,0 }, {2,0 }, {3,0} };
int fir[] = { 1,2,3,4,5 };
int sec[] = { 2,1,2,3,2,4,2,5 };
int thi[] = { 3,3,1,1,2,2,4,4,5,5 };
int suc = 0;
for (int i = 0; i < answers.size(); i++)
{
suc = answers[i];
if (suc == fir[i % 5])
stu[0].second++;
if (suc == sec[i % 8])
stu[1].second++;
if (suc == thi[i % 10])
stu[2].second++;
}
sort(stu.begin(), stu.end(), srt);
answer.push_back(stu[0].first);
int idx = 1;
while (idx < 3)
{
if (stu[idx].second < stu[0].second)
break;
answer.push_back(stu[idx].first);
idx++;
}
return answer;
}