p=7;

A=1;
B=1;
C=1;

D=1;
E=1;
F=2;

found = 0;

{for(i = 0, p - 1,
    for(j = 0, p - 1,
      for(k = 0, p - 1,
        if((A*i + B*j + C*k)%p == 0 &&
           (D*i + E*j + F*k)%p == 0 &&
           (i != 0 || j != 0 || k!= 0) &&
           found == 0,
           print(i," "j," "k); found = 1)
      )
    )
  )
}