main = getContents >>= putStr . unlines . map solve . map (map read . words) . init . lines
solve [a,b,c]
	| a == -1 || b == -1 || a + b < 30 = "F"
	| a + b >= 80 = "A"
	| a + b >= 65 = "B"
	| a + b >= 50 = "C"
	| a + b >= 30 = if c >= 50 then "C" else "D"