DSolve[-((y[x]*Derivative[1][f][x])/f[x]) - f[x]*Derivative[1][g][x] - a^n*f[x]^(1 - n)*y[x]^n*Derivative[1][g][x] + Derivative[1][y][x] == 0,y[x],x]