BERLIN — Ante Rebic scored a late hat trick to prevent Eintracht Frankfurt from making another first-round exit in the German Cup.

Frankfurt was knocked out at the first hurdle as defending champion last year, and it struggled against third-division Waldhof Mannheim on Sunday. It eventually prevailed 5-3 thanks to Rebic, who scored three goals in a 12-minute spell from the 76th.

Leipzig, which lost the final to Bayern Munich in May, also struggled before beating second-tier VfL Osnabrück 3-2 in Julian Nagelsmann's debut as Leipzig coach.

Neither of Berlin's Bundesliga clubs had any problems against fourth-tier sides. Promoted Union defeated Germania Halberstadt 6-0 and Hertha enjoyed a 5-1 victory at VfB Eichstätt in Ante Covic's first game as coach.

Both Hamburg teams were forced to go through penalty shootouts which Hamburger SV won 6-5 at third-division Chemnitzer FC and St. Pauli prevailed 4-3 at VfB Lübeck.

Cologne won 3-2 on penalties at second-division SV Wehen Wiesbaden with goalkeeper Timo Horn the hero for the visitors.

Defending champion Bayern faces fourth-tier side Energie Cottbus on Monday.

___

More AP German soccer coverage: https://apnews.com/Bundesliga and https://twitter.com/AP_Sports