Find index in 2D array using find_index

Hi,

i am trying to find the two dimensional index of array whose value matches to 1.
i am looking for array method like find_index can be used for the same. i can easily accomplish the same with foreach loop but would like to avoid it.

Below is the code where ind is a queue which has index of row if there is a column in the row has value = 1. if i need to get both row and column pair, how can it be done in below code?

initial begin 
	bit[3:0] arr1[3][3];
	int ind[$];

	foreach(arr1[i,j]) begin 
		arr1[i][j] = i+j;
	end

	ind = arr1.find_index(n) with (n.find_index(m) with (m==1));  //it return all row which has at least one column corresponding to value =1

	$display("array1 is = %p", arr1); 
	$display("index queue is = %p",ind);
$finish();
end

Thanks,
Amit

In reply to sv_uvm_learner_1:
I think foreach is the best way. Create a struct to hold index pairs.

module top;
   typedef struct {int X,Y;} pair_t;
   pair_t list[$];
   bit[3:0] arr1[3][3];
   
   initial begin
      // initialize
      foreach(arr1[i,j])arr1[i][j]  = $urandom_range(4);

      // find
      foreach(arr1[i,j]) if (arr1[i][j]==1)list.push_back('{i,j});
      $display("arr1\n %p \n list: %p", arr1,list);
   end
endmodule