function [out] = queries_n5t3(f)

n = 5;

E0 = eimat(n,0);
E1 = eimat(n,1);
E2 = eimat(n,2);
E3 = eimat(n,3);
E4 = eimat(n,4);
E5 = eimat(n,5);

cvx_begin quiet

  cvx_precision best;

  % variables m_ij : 0 <= i <= n, 0 <= j <= t-1
  
  variable m00(2^n,2^n) symmetric;
  variable m10(2^n,2^n) symmetric;
  variable m20(2^n,2^n) symmetric;
  variable m30(2^n,2^n) symmetric;
  variable m40(2^n,2^n) symmetric;
  variable m50(2^n,2^n) symmetric;
  
  variable m01(2^n,2^n) symmetric;
  variable m11(2^n,2^n) symmetric;
  variable m21(2^n,2^n) symmetric;
  variable m31(2^n,2^n) symmetric;
  variable m41(2^n,2^n) symmetric;
  variable m51(2^n,2^n) symmetric;
  
  variable m02(2^n,2^n) symmetric;
  variable m12(2^n,2^n) symmetric;
  variable m22(2^n,2^n) symmetric;
  variable m32(2^n,2^n) symmetric;
  variable m42(2^n,2^n) symmetric;
  variable m52(2^n,2^n) symmetric;
      
  variable g0(2^n,2^n) symmetric;
  variable g1(2^n,2^n) symmetric;
  
  variable epss;
  
  minimise( epss );
  
  subject to
  
    % Input condition.
  
    m00 + m10 + m20 + m30 + m40 + m50 == ones(2^n,2^n);
    
    % Running conditions (between 1 and t-1).
    
    m01 + m11 + m21 + m31 + m41 + m51 == E0 .* m00 + E1 .* m10 + E2 .* m20 + E3 .* m30 + E4 .* m40 + E5 .* m50;
    m02 + m12 + m22 + m32 + m42 + m52 == E0 .* m01 + E1 .* m11 + E2 .* m21 + E3 .* m31 + E4 .* m41 + E5 .* m51;
    
    % Output matches last but one query.
    
    g0 + g1 == E0 .* m02 + E1 .* m12 + E2 .* m22 + E3 .* m32 + E4 .* m42 + E5 .* m52;
    
    % Output constraints.
    
    diag(g0) >= (1-epss)*(1-f);
    diag(g1) >= (1-epss)*f;
    
    % Semidefinite constraints.

    m00 == semidefinite(2^n);
    m10 == semidefinite(2^n);
    m20 == semidefinite(2^n);
    m30 == semidefinite(2^n);
    m40 == semidefinite(2^n);
    m50 == semidefinite(2^n);
    
    m01 == semidefinite(2^n);
    m11 == semidefinite(2^n);
    m21 == semidefinite(2^n);
    m31 == semidefinite(2^n);
    m41 == semidefinite(2^n);
    m51 == semidefinite(2^n);
    
    m02 == semidefinite(2^n);
    m12 == semidefinite(2^n);
    m22 == semidefinite(2^n);
    m32 == semidefinite(2^n);
    m42 == semidefinite(2^n);
    m52 == semidefinite(2^n);
            
    g0 == semidefinite(2^n);
    g1 == semidefinite(2^n);
    
%cvx_problem

cvx_end

out = epss;