Narrative:

This was my first dual given flight. My private student and I were conducting landings to finish off lesson 15 at ZZZ. We came from practice area. The first 3 patterns were okay; traffic was not too busy and the flow was manageable. During these patterns; ZZZ tower was having a conversation with [another aircraft]; about performing 360 over [a reporting point] outside the class D airspace and how that could cause an issue with traffic coming into the airspace. When the conversation ended; at about my third pattern on upwind; I see a skyhawk over [another reporting point]; and the controller was yelling '[aircraft Y]; are you on frequency!' that crew replied; 'yes; we are;' tower replied; 'you entered the delta without contacting me.' I believe during that conversation; initially there was an archer heading southbound outside the pattern to enter traffic pattern for [runway] xxl. The crew's actions resulted in the pattern flow disturbed. The crew in the aircraft Z heading south turned and climbed into the pattern to avoid aircraft Y. We continued our upwind. By the time we were downwind; I saw aircraft Z above right us about 100 feet. I immediately reacted and descended. [A solution is to] increase situational awareness and stop teaching if I have to due to the business of congested airspace; and fly the airplane first to maintain safety of the flight.

Google
 

Original NASA ASRS Text

Title: C172 instructor pilot reported a NMAC while in the traffic pattern.

Narrative: This was my first dual given flight. My private student and I were conducting landings to finish off lesson 15 at ZZZ. We came from practice area. The first 3 patterns were okay; traffic was not too busy and the flow was manageable. During these patterns; ZZZ Tower was having a conversation with [another aircraft]; about performing 360 over [a reporting point] outside the Class D airspace and how that could cause an issue with traffic coming into the airspace. When the conversation ended; at about my third pattern on upwind; I see a Skyhawk over [another reporting point]; and the controller was yelling '[Aircraft Y]; are you on frequency!' That crew replied; 'yes; we are;' Tower replied; 'you entered the Delta without contacting me.' I believe during that conversation; initially there was an Archer heading southbound outside the pattern to enter traffic pattern for [Runway] XXL. The crew's actions resulted in the pattern flow disturbed. The crew in the Aircraft Z heading south turned and climbed into the pattern to avoid Aircraft Y. We continued our upwind. By the time we were downwind; I saw Aircraft Z above right us about 100 feet. I immediately reacted and descended. [A solution is to] increase situational awareness and stop teaching if I have to due to the business of congested airspace; and fly the airplane first to maintain safety of the flight.

Data retrieved from NASA's ASRS site and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.