class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: A = None
        self.txt = txt

g = A("g")
n = B("n")
j = C("j")
i = C("i")
k = C("k")
h = B("h")
m = B("m")

g.v = k
g.r = h
g.w = n
n.r = g
n.u = g
j.z = g
j.p = g
i.z = g
i.p = g
k.z = g
k.p = g
h.r = g
h.u = g
m.r = g
m.u = g
assert n.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: A = None
        self.txt = txt

g = A("g")
n = B("n")
j = C("j")
i = C("i")
k = C("k")
h = B("h")
m = B("m")

g.v = k
g.r = h
g.w = n
n.r = g
n.u = g
j.z = g
j.p = g
i.z = g
i.p = g
k.z = g
k.p = g
h.r = g
h.u = g
m.r = g
m.u = g
assert n.u.r.r.txt == "g"