#include <iostream>
int a = 10;
namespace M
{
int a = 20;
namespace N
{
int a = 30;
void f()
{
int x = a; //a refers to the name inside N, same as M::N::a
int y = M::a; //M::a refers to the name inside M
int z = ::a; //::a refers to the name in the global namespace
std::cout << x << ", "<< y << ", " << z << std::endl; //30,20,10
}
}
}
int main()
{
M::N::f();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IGEgPSAxMDsKbmFtZXNwYWNlIE0KewogICAgaW50IGEgPSAyMDsKICAgIG5hbWVzcGFjZSBOCiAgICB7CiAgICAgICAgICAgaW50IGEgPSAzMDsKICAgICAgICAgICB2b2lkIGYoKQogICAgICAgICAgIHsKICAgICAgICAgICAgICBpbnQgeCA9IGE7IC8vYSByZWZlcnMgdG8gdGhlIG5hbWUgaW5zaWRlIE4sIHNhbWUgYXMgTTo6Tjo6YQogICAgICAgICAgICAgIGludCB5ID0gTTo6YTsgLy9NOjphIHJlZmVycyB0byB0aGUgbmFtZSBpbnNpZGUgTQogICAgICAgICAgICAgIGludCB6ID0gOjphOyAvLzo6YSByZWZlcnMgdG8gdGhlIG5hbWUgaW4gdGhlIGdsb2JhbCBuYW1lc3BhY2UKCiAgICAgICAgICAgICAgc3RkOjpjb3V0IDw8IHggPDwgIiwgIjw8IHkgPDwgIiwgIiA8PCB6IDw8IHN0ZDo6ZW5kbDsgLy8zMCwyMCwxMAogICAgICAgICAgIH0KICAgIH0KfQppbnQgbWFpbigpIAp7CiAgICBNOjpOOjpmKCk7Cn0=