Matteo Trentin beats Peter Sagan in photo finish