python3
\ndef queensAttacktheKing(queens,king):\n\t\tfrom collections import defaultdict\n\t\ta=defaultdict(lambda: 8)\n\t\tfor x in queens:\n\t\t\tif x[0]==king[0] and
```\ndef queensAttacktheKing(queens,king):\n\t\tfrom collections import defaultdict\n\t\ta=defaultdict(lambda: 8)\n\t\tfor x in queens:\n\t\t\tif x[0]==king[0] and x[1]>king[1]:\n\t\t\t\ta["N"]=min(a["N"],x[1]-king[1])\n\t\telif x[0]==king[0] and x[1]<king[1]:\n\t\t\ta["S"]=min(a["S"],king[1]-x[1])\n\t\telif x[1]==king[1] and x[0]>king[0]:\n\t\t\ta["E"]=min(a["E"],x[0]-king[0]) \n\t\telif x[1]==king[1] and x[0]<king[0]:\n\t\t\ta["W"]=min(a["W"],king[0]-x[0])\n\t\telif x[1]-king[1]==x[0]-king[0] and x[1]>king[1]:\n\t\t\ta["NE"]=min(a["NE"],x[0]-king[0])  \n\t\telif x[1]-king[1]==x[0]-king[0] and x[1]<king[1]:\n\t\t\ta["SW"]=min(a["SW"],king[0]-x[0])  \n\t\telif x[1]-king[1]==-x[0]+king[0] and x[1]>king[1]:\n\t\t\ta["NW"]=min(a["NW"],x[1]-king[1])\n\t\telif x[1]-king[1]==-x[0]+king[0] and x[1]<king[1]:\n\t\t\ta["SE"]=min(a["SE"],x[0]-king[0])\n\t\telse:\n\t\t\tcontinue\n\tans=[]    \n\tfor x in a.keys():\n\t\ttmp=[king[0],king[1]]\n\t\tif a[x]<8:\n\t\t\tif x=="N":\n\t\t\t\ttmp[1]+=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="S":\n\t\t\t\ttmp[1]-=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="W":\n\t\t\t\ttmp[0]-=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="E":\n\t\t\t\ttmp[0]+=a[x]\n\t\t\t\tans.append(tmp)    \n\t\t\telif x=="NE":\n\t\t\t\ttmp[0]+=a[x]\n\t\t\t\ttmp[1]+=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="NW":\n\t\t\t\ttmp[0]-=a[x]\n\t\t\t\ttmp[1]+=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="SE":\n\t\t\t\ttmp[0]+=a[x]\n\t\t\t\ttmp[1]-=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telif x=="SW":\n\t\t\t\ttmp[0]-=a[x]\n\t\t\t\ttmp[1]-=a[x]\n\t\t\t\tans.append(tmp)\n\t\t\telse:\n\t\t\t\tcontinue    \n\treturn ans\n\t```
[]