TRAILS: Tree reconstruction of ancestry using incomplete lineage sorting