let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});
process.stdin.on('end', () => {
  const students = content
    .trim()
    .split('\n')
    .map(line => line.split(' ').map(n => parseInt(n, 10)))
    .slice(0, -1);

  const result = students.map(getGrade).join('\n');
  console.log(result);
});

const getGrade = ([mid, final, re]) => {
  if (mid === -1 || final === -1) {
    return 'F';
  }

  const midFinal = mid + final;
  if (midFinal >= 80) {
    return 'A';
  } else if (midFinal >= 65 && midFinal < 80) {
    return 'B';
  } else if (midFinal >= 50 && midFinal < 65) {
    return 'C';
  } else if (midFinal >= 30 && midFinal < 50) {
    return re >= 50 ? 'C' : 'D';
  } else {
    return 'F';
  }
};
