come out ahead vs gain mastery

come out ahead

gain mastery

How often have the words come out ahead and gain mastery occurred in a corpus of books? (source: Google Ngram Viewer )