On side $AE$ of regular pentagon $ABCDE$ there is an equilateral triangle $AEF$, and on side $AB$ of the pentagon there is a square $ABHG$ as shown. Find the degree measure of angle $AFG$.
[img]https://cdn.artofproblemsolving.com/attachments/7/7/0d689d2665e67c9f9afdf193fb0a2db6dddb3d.png[/img]
1. **Identify the angles involved:**
   - Since $AEF$ is an equilateral triangle, $\angle FAE = 60^\circ$.
   - Since $ABCDE$ is a regular pentagon, each internal angle is $108^\circ$. Therefore, $\angle EAB = 108^\circ$.
   - Since $ABHG$ is a square, $\angle BAG = 90^\circ$.

2. **Calculate $\angle FAG$:**
   \[
   \angle FAG = 360^\circ - \angle FAE - \angle EAB - \angle BAG
   \]
   Substituting the known values:
   \[
   \angle FAG = 360^\circ - 60^\circ - 108^\circ - 90^\circ = 102^\circ
   \]

3. **Determine $\angle AFG$ and $\angle AGF$:**
   - Since $FA = AG$ (both are sides of the equilateral triangle and the square respectively), $\triangle AFG$ is isosceles with $\angle AFG = \angle AGF$.
   - The sum of angles in $\triangle AFG$ is $180^\circ$. Therefore:
   \[
   \angle AFG + \angle AGF + \angle FAG = 180^\circ
   \]
   Since $\angle AFG = \angle AGF$, let $\angle AFG = \angle AGF = x$. Then:
   \[
   2x + 102^\circ = 180^\circ
   \]
   Solving for $x$:
   \[
   2x = 180^\circ - 102^\circ
   \]
   \[
   2x = 78^\circ
   \]
   \[
   x = 39^\circ
   \]

The final answer is $\boxed{39^\circ}$.