Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			math, _ := strconv.Atoi(buf[0])
			english, _ := strconv.Atoi(buf[1])
			japanese, _ := strconv.Atoi(buf[2])
			if math == 100 || english == 100 || japanese == 100 {
				fmt.Println("A")
			} else if math + english >= 180 {
				fmt.Println("A")
			} else if math + english + japanese >= 240 {
				fmt.Println("A")
			} else if math + english + japanese >= 210 {
				fmt.Println("B")
			} else if math + english + japanese >= 150 && (math >= 80 || english >= 80) {
				fmt.Println("B")
			} else {
				fmt.Println("C")
			}
		}
	}
}

C++: #include<stdio.h>
int main(void)
{
    int i,a,b[10001],c[10001],d[10001];
	while(1){
	scanf("%d",&a);
	if(a==0) break;
	for(i=0;i<a;i++){
	scanf("%d %d %d",&b[i],&c[i],&d[i]);
	}
	for(i=0;i<a;i++){
	if(b==100||c==100||d==100){
	printf("A\n");
	}
	else if((b+c)/2>=90){
	printf("A\n");
	}
	else if((b+c+d)/3>=80){
	printf("A\n");
	}
	else if((b+c+d)/3>=70){
	printf("B\n");
	}
	else if((b+c+d)/3>=50){
	if(b>=80||c>=80){
	printf("B\n");
	}
	}
	else{
	printf("C\n");
	}
	}
	}
	return 0;
	}

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	int n;
	int m[100] = {};
	int e[100] = {};
	int j[100] = {};
	string rank[10000] = {};
	int g = 0;
	while (cin >> n&&n) {
		for (int k = 0; k < n; k++) {
			cin >> m[k] >> e[k] >> j[k];
		}
		for (int i = 0; i < n; i++) {
			int s = (m[i] + e[i] + j[i]) / 3;
			g++;
			if ((m[i] == 100)||(e[i] == 100)||(j[i] == 100)) {
				rank[i] = "A";
			}
			else if ((m[i] + e[i]) / 2 >= 90) {
				rank[i] = "A";
			}
			else if (s >= 80) {
				rank[i] = "A";
			}
			else if (s >= 70) {
				rank[i] = "B";
			}
			else if (s >= 50 && m[i] >= 80) {
				rank[i] = "B";
			}
			else {
				rank[i] = "C";
			}
		}

	}
	for (int l = 0; l <g; l++) {
		cout << rank[l] << endl;
	}

	return 0;
	
}

C++: #include<iostream>
using namespace std;

int main(){
  int i,n;
  int pm,pe,pj;
  char ans;

  while(1){
    cin >> n;
    if(!n)break;

    for(i=0;i<n;i++){
      cin >> pm >> pe >> pj;
      if(pm==100 || pe==100 || pj==100)ans = 'A';
      else if( (pm+pe)/2 >= 90 )ans = 'A';
      else if( (pm+pe+pj)/3 >= 80 )ans = 'A';
      else if( (pm+pe+pj)/3 >= 70 )ans = 'B';
      else if( (pm+pe+pj)/3 >= 50 && (pm>=80 || pe>=80) )ans = 'B';
      else ans = 'C';
      cout << ans << endl;
    }
  }
}

C++: #include<stdio.h>

int main(void){
	int i,n,t1,t2,j,m,e;
	while(0==0)
	{
		scanf("%d",&n);
		if(n==0)break;

		for(i=0;i<n;i++){
			scanf("%d %d %d",&m,&e,&j);
			t1=m+e;  t2=m+e+j;
			if((m==100 || e==100 || j==100) || (t1>=180) || (t2>=240))
				printf("A\n");
			else if((t2>=210) || (t2>=150 && ( m>=80 || e>=80)))
				printf("B\n");
			else printf("C\n");
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int n;

string func(int x,int y,int z){
	if(x - 100 && y - 100 && z - 100){
		if(x+y>=180){
			return "A";
		}
		if(x+y+z >= 240){
			return "A";
		}
		if(x+y+z >= 210){
			return "B";
		}
		if(x+y+z>=150){
			if(x>=80||y>=80){
				return "B";
			}
		}
		return "C";
		
	}else{
		return "A";
	}
}

int main(void){
	cin >> n;
	while(n){
		for(int i =0 ; i< n ; i++){
			int pm,pe,pj;
			cin >> pm >> pe >> pj;
			string ans = func(pm,pe,pj);
			cout << ans << endl;
		}
		cin >> n;
	}
}

C++: #include <iostream>

char DividingStudent(int pm, int pe, int pj)
{
    if (pm==100 || pm==100 || pj==100) {
        return 'A';
    } else if ((pm+pe)/2 >= 90){
        return 'A';
    } else if ((pm+pe+pj)/3 >= 80){
        return 'A';
    } else if ((pm+pe+pj)/3 >= 70){
        return 'B';
    } else if ((pm+pe+pj)/3 >= 50 && (pm>=80 || pe>=80)) {
        return 'B';
    } else {
        return 'C';
    }
}

int main()
{
    while(1){
        int n;
        std::cin >> n;
        if(n==0){
            break;
        }
        for (int i=0; i<n; i++) {
            int pm,pe,pj;
            std::cin >> pm >>pe >>pj;
            std::cout << DividingStudent(pm, pe, pj) << std::endl;
        }
    }
}

C++: #include<iostream>
using namespace std;
int main(void)
{
    int n,pm[10001],pe[10001],pj[10001];
    while(1){
        cin>>n;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>pm[i]>>pe[i]>>pj[i];
        }
        for(int i=0;i<n;i++){
            if(pm[i]==100||pe[i]==100||pj[i]==100||(pm[i]+pe[i])/2>=90||(pm[i]+pe[i]+pj[i])/3>=80)
                cout<<"A\n";
            else if((pm[i]+pe[i]+pj[i])/3>=70)cout<<"B\n";
            else if((pm[i]>=80||pe[i]>=80)&&(pm[i]+pe[i]+pj[i])/3>=50)cout<<"B\n";
            else cout<<"C\n";
        }
    }
}

C++: #include<stdio.h>
int main(void)
{
	int n,m,e,j,i,cls[10000],flg;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			flg=0;
			scanf("%d %d %d",&m,&e,&j);
			if(m==100||e==100||j==100||(m+e)/2>=90||(m+e+j)/3>=80){
				cls[i]=1;
				flg=1;
			}
			if((m+e+j)/3>=70&&(m+e+j)/3<80){
				flg++;
				cls[i]=2;
			}
			if(((m+e+j)/3>=50&&(m+e+j)/3<80)&&(m>=80||e>=80)){
				flg++;
				cls[i]=2;
			}
			if(flg>=2){
				cls[i]=1;
			}
			if(flg<1){
				cls[i]=3;
			}
		}
		for(i=0;i<n;i++){
			if(cls[i]==1){
				printf("A\n");
			}
			if(cls[i]==2){
				printf("B\n");
			}
			if(cls[i]==3){
				printf("C\n");
			}

		}
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int n,pm,pe,pj,i,s,d;
	while(1){
	    scanf("%d",&n);
	    if (n==0) {
    		break;
		}
		else {
			for (i=0;i<n;i++){
				scanf("%d %d %d",&pm,&pe,&pj);
				
				if (pm>=100||pe>=100||pj>=100){
					printf("A\n");
				}
				else if ((pm+pe)/2>=90){
					printf("A\n");
				}
				else if ((pm+pe+pj)/3>=80){
				    printf("A\n");
				}
				else if ((pm+pe+pj)/3>=70){
					printf("B\n");
				}
				else if ((pm+pe+pj)/3>=50&&(pm>=80||pe>=80)){
					printf("B\n");
				}
				else {
					printf("C\n");
				}
			}
			return 0;
		}
	}
}

C++: #include <stdio.h>

void judge(int pm, int pe, int pj);

int main(void)
{
    int dataset;
    int pm, pe, pj;

    while (1){
        scanf("%d", &dataset);
        if (dataset == 0){
            break;
        } else {
            while (dataset--){
                scanf("%d %d %d", &pm, &pe, &pj);
                judge(pm, pe, pj);
            }
        }
    }

    return 0;
}

void judge(int pm, int pe, int pj)
{
    if (pm == 100 || pe == 100 || pj == 100){
        printf("A\n");
    } else if (pm + pe >= 90 * 2){
        printf("A\n");
    } else if (pm + pe + pj >= 80 * 3){
        printf("A\n");
    } else if (pm + pe + pj >= 70 * 3){
        printf("B\n");
    } else if (pm + pe + pj >= 50 * 3 && (pm >= 80 || pe >= 80)){
        printf("B\n");
    } else {
        printf("C\n");
    }
}

C++: #include <stdio.h>

void judge(int pm, int pe, int pj)
{
    int sum = pm + pe + pj;
    char class;

    if (pm == 100 || pe == 100 || pj == 100){
        class = 'A';
    } else if (pm + pe >= 180){
        class = 'A';
    } else if (sum >= 240){
        class = 'A';
    } else if (sum >= 210){
        class = 'B';
    } else if (sum >= 150 && (pm >= 80 || pe >= 80)){
        class = 'B';
    } else {
        class = 'C';
    }

    printf("%c\n", class);
}

int main(void)
{
    int dataset;
    int pm, pe, pj;

    while (1){
        scanf("%d", &dataset);
        if (dataset == 0){
            break;
        } else {
            while (dataset--){
                scanf("%d %d %d", &pm, &pe, &pj);
                judge(pm, pe, pj);
            }
        }
    }

    return 0;
}