check_it_is_a_line(a_0, a_1, a_2, a_3, b_0, b_1, b_2, b_3) =
{
local(m);
m = matrix(2,2);
for(i = 1, 4,
  for(j = i + 1, 4,
    v = [a_0, a_1, a_2, a_3; b_0, b_1, b_2, b_3];
      m[1,1] = v[1,i];
      m[1,2] = v[2,i];
      m[2,1] = v[1,j];
      m[2,2] = v[2,j];
      if(matdet(m) % p != 0, return(1))
 )
);
return(0)
}

list_lines(p, A, B, C, D, E, F, G, H, J, K) ={

(L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3) = [a_0*S + b_0*T, a_1*S + b_1*T, a_2*S + b_2*T, a_3*S + b_3*T]);
(g(W, X, Y, Z) =A*W^2 + B*W*X +C*W*Y + D*W*Z + E*X^2 + F*X*Y + G*X*Z + H*Y^2 + J*Y*Z + K*Z^2);
for(a_0 = 0, p-1,
  for(b_0 = 0, p-1,
    for(a_1= 0, p-1,
      for(b_1= 0, p-1,
        for(a_2 = 0, p-1,
          for(b_2= 0, p-1,
            for(a_3 = 0, p-1,
              for(b_3= 0, p-1,
                if(check_it_is_a_line(a_0, a_1, a_2, a_3, b_0, b_1, b_2, b_3) && g(L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3)[1],L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3)[2], L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3)[3], L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3)[4]) *Mod(1,p) == 0,
                  print("f(S,T) ="L(a_0, b_0, a_1, b_1, a_2, b_2, a_3, b_3))
                )
              )
            )
          )
        )
      )
    )
  )
)
}