At first b value=12. It makes global b value as 12 too. Now, N is called and b value increments by 1. As it is pass by reference it refers to same b as global variable pointing to. And b value becomes 13. Global variable b also 13. Now, b is passed to M and b is passed with different name(called aliases) as a , where value of a is also 13.Now, to a*a=169. So, final a value is 169. global variable b is also 169.
Now, control return back to main, which prints b value same as global variable i.e. b=169