Massey products and ideal class groups