Serbia beat Hungary 10-8 to win bronze medal at the European water polo championships in Zagreb, Croatia.