def distance(p1, p2):

return pow(p1[0]-p2[0], 2) + pow(p1[1]-p2[1], 2)

```
mapping = {}
mapping[distance(p1,p2)] = 1
mapping[distance(p1,p3)] = 1
mapping[distance(p1,p4)] = 1
if 0 in mapping or len(mapping) != 2:
return False
mapping[distance(p2,p3)] = 1
mapping[distance(p2,p4)] = 1
if len(mapping) != 2:
return False
mapping[distance(p3,p4)] = 1
if len(mapping) != 2:
return False
return True
```