import copy


def min_specializations(h,domains,x):
  """Implement a function min_specializations(h, domains, x)
  for a hypothesis h and an example x. The argument
  domains is a list of lists, in which the i-th
  sub-list contains the possible values of feature i.
  The function should return all minimal specializations
  of h with respect to domains which are not fulfilled by x."""
  specializations = []

  for i,element in enumerate(h):
    if element == "?":
      possible_values = copy.deepcopy(domains[i])
      possible_values.remove(x[i])
      for val in possible_values:
        temp_h = list(h)
        temp_h[i] = val
        specializations.append(tuple(temp_h))
    else:
      temp_h = list(h)
      temp_h[i] = "T"
      specializations.append(tuple(temp_h))
  return specializations