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

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

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

n = A("n")
h = B("h")
e = C("e")
g = A("g")
d = B("d")
c = A("c")

n.t = e
n.u = c
h.v = e
h.o = d
h.z = d
e.r = h
e.p = h
g.t = e
g.u = c
d.v = e
d.o = h
d.z = h
c.t = e
c.u = n
assert g.t.p.z.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
e = C("e")
g = A("g")
d = B("d")
c = A("c")

n.t = e
n.u = c
h.v = e
h.o = d
h.z = d
e.r = h
e.p = h
g.t = e
g.u = c
d.v = e
d.o = h
d.z = h
c.t = e
c.u = n
assert g.t.p.z.v.r.txt == "h"