【Analysis】As shown in the figure, connect HF. Let's assume the side length of the two squares is a. From the given, GH=HE=21a,DF=31a,FC=32a. Since GM//DF, we have DFGM=ADAG=21⇒GM=61a.
Therefore, MH=GH−GM=31a.
By the hourglass theorem, IDHI=DFMH=1⇒HI=ID.
So SHIF=21SHDF=21×31SHDC=21×31×21SGECD=121m.
Since EN//CF, we have CFEN=BCBE=21⇒EN=31a.
So NH=EH−EN=61a.
By the hourglass theorem, JCHJ=CFHN=41⇒HJ=41×JC.
So SHJF=51SHCF=51×32SHDC=51×32×21SGECD=151 m.
Therefore, n=121m+151m=203m.
Since m,n are both positive integers, m must be a multiple of 20, i.e., m contains the prime factors 2 and 5. Also, since m has 9 divisors, m=22×52=100.
Therefore, the side length of the square ABEG is 10 cm.