Source: https://cse.buffalo.edu/~hungngo/classes/2004/594/notes/matching.pdf