It's pretty simple: Check the top row for which spell they've chosen to use, then follow down its column down to an X, then follow that row backwards to see which spell you use to beat them.