- using pairs of N*N to transfer the problem to 2-sum problem.
- if a matched pairs exist, when you index the second items, the first exist in index, so we can check and index items in one N**2 loop.

Here is my AC codes:

```
_result = []
_dic = {}
# rank for the non-descending-order of the result
num.sort()
for i in range(len(num)):
for j in range(i+1, len(num)):
_ijsum = num[i] + num[j]
#judge whether pairs exist in hash structure
if target - _ijsum in _dic:
for (a,b) in _dic[target - _ijsum]:
# a must be smaller than i, so b<i guarantee (a,b,i,j)
# follow the non-descending order
if b<i and [num[a], num[b],num[i], num[j]] not in _result:
_result.append([num[a],num[b],num[i],num[j]])
if _ijsum in _dic:
_dic[_ijsum].append((i,j))
else:
_tem = []
_tem.append((i,j))
_dic[_ijsum] = _tem
return _result
```