Stairs were invented first. They were invented as a way to move from one level of a building to another, and were essential for the construction of larger, multi-level structures. Floors were not invented until after stairs, as a way to provide a level surface for walking in those structures.