1.

package contestVolumes.volume118;

import java.util.Scanner;

/**
 * FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
 * Problem: 11839 - Optical Reader
 * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=226&problem=2939&mosmsg=Submission+received+with+ID+8260045
 *
 * @author Siegfried Ippisch
 * @version 1.0
 *
 * Method : -
 * Status : Accepted
 * Runtime: 0.220
 */
public class OpticalReader {
   
    public static final int X = 127;
   
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
       
        int n = in.nextInt();
        while(n != 0){
            while(n-- > 0){
                boolean[] x = new boolean[5];
                for(int i=0; i<5; i++)
                    x[i] = in.nextInt() <= X;
                System.out.println(getAnswer(x));
            }
            n = in.nextInt();
        }
       
        in.close();
    }
   
    public static char getAnswer(boolean[] x){
        int c = 0;
        int s = 0;
        for(int i=0; i<x.length; i++)
            if(x[i]){
                c++;
                s=i;
            }
        if(c==1)
            return (char) ('A'+s);
        return '*';
    }
}