text: Below is an context that describes a sql query, paired with an question that provides further information. Write an answer that appropriately completes the request.  # noqa: E501
  ### Context:
  CREATE TABLE table_name_40 (first_elected INTEGER, results VARCHAR, incumbent VARCHAR)
  ### Question:
  What is the latest year for first elected with john hostettler as incumbent and a result of lost re-election democratic gain?
  ### Answer:
  SELECT MAX(first_elected) FROM table_name_40 WHERE results = "lost re-election democratic gain" AND incumbent = "john hostettler"