function v=wq(U)
% take in solutions U

[m,n,o]=size(U);

s1=zeros(m,n);s2=s1;s3=s1;s4=s1;s5=s1;s6=s1;
s7=s1;s8=s1;s9=s1;s10=s1;s11=s1;s12=s1;

% exact solns from:
% http://www.cs.rutgers.edu/~chvatal/8queens.html

% first exact soln
s1(1,1)=1;s1(2,5)=1;s1(3,8)=1;s1(4,6)=1;s1(5,3)=1;s1(6,7)=1;s1(7,2)=1;s1(8,4)=1;

% 2nd exact soln
s2(1,1)=1;s2(2,6)=1;s2(3,8)=1;s2(4,3)=1;s2(5,7)=1;s2(6,4)=1;s2(7,2)=1;s2(8,5)=1;

% 3rd exact soln
s3(1,2)=1;s3(2,4)=1;s3(3,6)=1;s3(4,8)=1;s3(5,3)=1;s3(6,1)=1;s3(7,7)=1;s3(8,5)=1;

% 4th exact soln
s4(1,2)=1;s4(2,5)=1;s4(3,7)=1;s4(4,1)=1;s4(5,3)=1;s4(6,8)=1;s4(7,6)=1;s4(8,4)=1;

% 5th exact soln
s5(1,2)=1;s5(2,5)=1;s5(3,7)=1;s5(4,4)=1;s5(5,1)=1;s5(6,8)=1;s5(7,6)=1;s5(8,3)=1;

% 6th exact soln
s6(1,2)=1;s6(2,6)=1;s6(3,1)=1;s6(4,7)=1;s6(5,4)=1;s6(6,8)=1;s6(7,3)=1;s6(8,5)=1;

% 7th exact soln
s7(1,2)=1;s7(2,6)=1;s7(3,8)=1;s7(4,3)=1;s7(5,1)=1;s7(6,4)=1;s7(7,7)=1;s7(8,5)=1;

% 8th exact soln
s8(1,2)=1;s8(2,7)=1;s8(3,3)=1;s8(4,6)=1;s8(5,8)=1;s8(6,5)=1;s8(7,1)=1;s8(8,4)=1;

% 9th exact soln
s9(1,2)=1;s9(2,7)=1;s9(3,5)=1;s9(4,8)=1;s9(5,1)=1;s9(6,4)=1;s9(7,6)=1;s9(8,3)=1;

% 10th exact soln
s10(1,3)=1;s10(2,5)=1;s10(3,8)=1;s10(4,4)=1;s10(5,1)=1;s10(6,7)=1;s10(7,2)=1;s10(8,6)=1;

% 11th exact soln
s11(1,3)=1;s11(2,6)=1;s11(3,2)=1;s11(4,5)=1;s11(5,8)=1;s11(6,1)=1;s11(7,7)=1;s11(8,4)=1;

% 12th exact soln
s12(1,3)=1;s12(2,5)=1;s12(3,2)=1;s12(4,8)=1;s12(5,1)=1;s12(6,7)=1;s12(7,4)=1;s12(8,6)=1;

S(:,:,1)=s1;S(:,:,2)=s2;S(:,:,3)=s3;S(:,:,4)=s4;S(:,:,5)=s5;S(:,:,6)=s6;
S(:,:,7)=s7;S(:,:,8)=s8;S(:,:,9)=s9;S(:,:,10)=s10;S(:,:,11)=s11;S(:,:,12)=s12;

v=zeros(1,o);

for i=1:o,
    for j=1:12,
        if ((sum(sum(U(:,:,i)~=S(:,:,j)))==0)|(sum(sum((U(:,:,i)')~=S(:,:,j)))==0)|(sum(sum(U(end:-1:1,:,i)~=S(:,:,j)))==0)|(sum(sum((U(end:-1:1,:,i)')~=S(:,:,j)))==0)|(sum(sum(U(:,end:-1:1,i)~=S(:,:,j)))==0)|(sum(sum((U(:,end:-1:1,i)')~=S(:,:,j)))==0)|(sum(sum(U(end:-1:1,end:-1:1,i)~=S(:,:,j)))==0)|(sum(sum((U(end:-1:1,end:-1:1,i)')~=S(:,:,j)))==0)),
            v(i)=j;
        end
    end
end    
