How long did the Tripartite struggle last?