I am facing following two similar kind of problems:

Problem(1) Suppose I have the following code:

```
A=matrix(2,2,[1,1,1,1])
B=matrix(2,2,[2,2,2,2])
C=matrix(2,2,[3,3,3,3])
D=matrix(2,2,[4,4,4,4])
L1=[A,B,C]
L2=[C,B,A]
L3=[A,C,D]
show(L1,L2,L3)
```

Then in the output I want only L1 and L3 only as L1 and L2 contain same matrices.

Problem(2): Now suppose we have the following code:

```
P=matrix(2,2,[5,5,5,5])
Q=matrix(2,2,[6,6,6,6])
R=matrix(2,2,[7,7,7,7])
S=matrix(2,2,[8,8,8,8])
T1=[P,P,Q]
T2=[Q,P,P]
T3=[P,R,S]
show(T1,T2,T3)
```

Here also, in the output I want T1 and T3 only as T1 and T2 contain same matrices. Note that I want T1 as it is, that is, P should be there twice.