Need to findout all possible combinations of 3 variables summing upto 20

Hi Everyone,

I want to find out all possible combinations of 3 variables which sum up to 20. I used a queue to get the unique values, it works well for 2 variables. But for 3 variables it misses out some combinations.

if a=2,b=2,c=16; is present a=2,b=3,c=15 will be missed, as it is already present in the queue.
Is there a way to store the combination of a,b,c and then check it is covering all values?

class rand_val;
    rand int a,b,c;
    int a_val[$];
    int b_val[$];
    int c_val[$];
    int X=20;

    constraint val_c {a+b+c == X;a >= 2; a <= 14; b >= 2; b <= 14; c >= 2; c <= 14;} 
    constraint uniq_c{(!(a inside {a_val}) && !(b inside {b_val}) && !(c inside {c_val}));}
   function void print();
  
            $display("The values are %d, %d, %d", a,b,c);
    
     
   endfunction

   function void post_randomize();
     a_val.push_back(a);
     b_val.push_back(b);
     c_val.push_back(c);
   endfunction
endclass


module top;

    initial
    begin
      
      rand_val r;
      r=new();
      forever begin
        if(!r.randomize()) begin
          $display("Unique A is %p", r.a_val);
          $display("Unique B is %p", r.b_val);
          $display("Unique C is %p", r.c_val);
          break;
        end
      end
      $finish;
    end

endmodule

In reply to skundral:
Try packing the three variables before pushing them into a single queue.

class A;
   rand bit [3:0] A,B,C;
        bit [2:0][3:0] queue[$];
   
   constraint val_c {(A+B+C) == 20;
      A inside {[2:14]};
      B inside {[2:14]};
      C inside {[2:14]};
}
   constraint uniq_c {!({A,B,C} inside {queue});}
   function void post_randomize();
      queue.push_back({A,B,C});
   endfunction : post_randomize
   
endclass : A
module top;
   A h;

   initial begin
      h = new;
      forever  begin
	 if(!h.randomize()) break;
	 $display(h.A,,h.B,,h.C);
      end
      $display("%p",h.queue,, h.queue.size());
   end
   
endmodule : top