class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: B = None
        self.v: E = None
        self.t: E = None
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

j = A("j")
h = B("h")
k = C("k")
g = D("g")
i = E("i")
e = B("e")
n = D("n")

j.z = g
j.r = h
j.v = i
j.t = i
j.u = e
h.r = i
k.x = j
g.z = i
g.q = n
i.o = g
e.r = i
n.z = i
n.q = g
assert g.z.o.z.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: B = None
        self.v: E = None
        self.t: E = None
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

j = A("j")
h = B("h")
k = C("k")
g = D("g")
i = E("i")
e = B("e")
n = D("n")

j.z = g
j.r = h
j.v = i
j.t = i
j.u = e
h.r = i
k.x = j
g.z = i
g.q = n
i.o = g
e.r = i
n.z = i
n.q = g
assert g.z.o.z.o.z.o.txt == "g"