Chemical Attraction
题目描述
[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=23&page=show_problem&problem=2060
[PDF](https://uva.onlinejudge.org/external/111/p11119.pdf)
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11119/57c7232684f3943f33578e8a2353b0902f45fa8c.png)
输入输出格式
输入格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11119/cf309fdcb02aab731d2607ca8b2fa9ff1aae541b.png)
输出格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11119/480fa20085371080013f9d79a0e93f90a679e99e.png)
输入输出样例
输入样例 #1
3
Ba Sr Th
3
Cl Br Fl
1 2 3
1 3 2
2 1 3
2 1 3
1 3 2
1 2 3
3
BaFl SrBr ThCl
5
BaFl BaFl SrFl SrCl ThFl
0
3
Na Ag Fe
5
Su Zi Xe Ar Do
1 2 4 3 5
5 3 1 2 4
2 3 1 4 5
3 2 1
3 2 1
1 3 2
1 2 3
2 1 3
10
NaDo AgDo AgAr FeXe NaXe
AgZi AgZi NaSu AgSu FeDo
0
0
输出样例 #1
Scenario 1, Mixture 1:
BaCl SrBr ThFl
Scenario 1, Mixture 2:
BaFl BaCl SrFl SrFl ThFl
Scenario 2, Mixture 1:
NaDo AgSu AgSu FeDo NaXe AgZi AgZi NaXe AgAr FeDo