input: Write a python function to merge three dataframes on a common column 'ID' and return the merged dataframe.
  ```python
  def merge_dataframes(df1, df2, df3):
      merged_data = pd.merge(df1, df2, on='ID')
      merged_data = pd.merge(merged_data, df3, on='ID')
      return merged_data
  
  # Test cases
  assert merge_dataframes(pd.DataFrame({'ID': [1, 2], 'A': ['foo', 'bar']}), 
                          pd.DataFrame({'ID': [1, 2], 'B': ['baz', 'qux']}), 
                          pd.DataFrame({'ID': [1, 2], 'C': ['quux', 'corge']})).equals(
      pd.DataFrame({'ID': [1, 2], 'A': ['foo', 'bar'], 'B': ['baz', 'qux'], 'C': ['quux', 'corge']})
  )
  
  assert merge_dataframes(pd.DataFrame({'ID': [1, 3], 'A': ['apple', 'orange']}), 
                          pd.DataFrame({'ID': [1, 3], 'B': ['banana', 'grape']}), 
                          pd.DataFrame({'ID': [1, 3], 'C': ['pear', 'peach']})).equals(
      pd.DataFrame({'ID': [1, 3], 'A': ['apple', 'orange'], 'B': ['banana', 'grape'], 'C': ['pear', 'peach']})
  )
  
  assert merge_dataframes(pd.DataFrame({'ID': [1, 2, 3], 'A': [10, 20, 30]}), 
                          pd.DataFrame({'ID': [1, 2, 3], 'B': [100, 200, 300]}), 
                          pd.DataFrame({'ID': [1, 2, 3], 'C': [1000, 2000, 3000]})).equals(
      pd.DataFrame({'ID': [1, 2, 3], 'A': [10, 20, 30], 'B': [100, 200, 300], 'C': [1000, 2000, 3000]})
  )
output: def merge_dataframes(df1, df2, df3):
      merged_data = pd.merge(df1, df2, on='ID')
      merged_data = pd.merge(merged_data, df3, on='ID')
      return merged_data