function [ output_args ] = s4q5( list )

sumsto=zeros(990,1);

for (ii=1:1023)
    sum1 = 0;
    for (jj=0:9)
        if (mod(floor(ii/(2^jj)),2)==1)
            sum1 = sum1+list(jj+1);
        end
    end
    if (sumsto(sum1)<1)
        sumsto(sum1)=ii;
    else
        kk=1;
        for (jj=0:9)
            if (mod(floor(sumsto(sum1)/(2^jj)),2)==1)
                disp1(kk)=list(jj+1);
                kk=kk+1;
            end
        end
        kk=1;
        for (jj=0:9)
            if (mod(floor(ii/(2^jj)),2)==1)
                disp2(kk)=list(jj+1);
                kk=kk+1;
            end
        end
        disp(disp1)
        disp(disp2)
        return
    end
end

disp("failed to find match. Were the inputs correct?")
    


end

