Scotland and Wales to enter Brexit lawsuit