Strongest fighter

Hey what is wrong in this code
getting output 3 4 4 instead of 3 5 5
code has been saved at the given link

line 36
cout<<arr[q.front()];

hey i have changed the code and now getting correct output of that input but none of my test cases is being passed when submitting

if(!q.empty() && arr[i]>arr[q.back()]){
		q.pop_back();
	}

line 20 is incorrect

desired
while(!q.empty() && arr[i]>=arr[q.back()]){
q.pop_back();
}