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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
c = C("c")
n = B("n")
i = C("i")
g = C("g")
b = B("b")
e = A("e")

h.v = m
h.z = g
h.w = g
m.t = n
m.u = n
m.o = n
c.q = m
c.p = h
c.t = b
n.t = b
n.u = b
n.o = b
i.q = b
i.t = b
i.p = h
g.q = n
g.p = e
g.t = m
b.t = m
b.u = n
b.o = n
e.v = m
e.z = i
e.w = c
assert m.o.o.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: C = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
c = C("c")
n = B("n")
i = C("i")
g = C("g")
b = B("b")
e = A("e")

h.v = m
h.z = g
h.w = g
m.t = n
m.u = n
m.o = n
c.q = m
c.p = h
c.t = b
n.t = b
n.u = b
n.o = b
i.q = b
i.t = b
i.p = h
g.q = n
g.p = e
g.t = m
b.t = m
b.u = n
b.o = n
e.v = m
e.z = i
e.w = c
assert m.o.o.t.t.txt == "n"