Solution to the ternary assignment problem for tweetsAfterId