how was john quincy adams related to john adams?

a)he was his son
b) he was his cousin
c) he was his nephew
d) he was his grandson