an or auf, then Dativ or Akkusativ — at work and in class.
Type an or auf — or am, ans, aufs where they run together — then the article in the right case. The noun's gender is shown.
Where something is: an or auf + Dativ. auf is on top of a surface (Tisch, Boden, Sofa) or an open place (Markt, Spielplatz); an is against a side or an edge (Wand, Tür, Fenster, Meer, See). an dem → am.
Where something goes: the same prepositions + Akkusativ. an das → ans, auf das → aufs.
These verbs always take the same preposition and case — learn them as one chunk: warten auf + Akk, denken an + Akk, teilnehmen an + Dat.
an or auf, then the case. am, ans and aufs fill the gap on their own.