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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: D = None
        self.y: E = None
        self.txt = txt

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

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

g = A("g")
a = B("a")
e = C("e")
b = D("b")
l = E("l")
d = D("d")
n = E("n")
i = D("i")

g.r = l
a.t = b
a.z = b
a.x = b
a.s = g
e.v = g
e.z = i
e.y = n
b.r = a
b.o = g
l.z = g
d.r = a
d.o = g
n.z = g
i.r = a
i.o = g
assert a.z.o.r.z.r.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: D = None
        self.y: E = None
        self.txt = txt

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

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

g = A("g")
a = B("a")
e = C("e")
b = D("b")
l = E("l")
d = D("d")
n = E("n")
i = D("i")

g.r = l
a.t = b
a.z = b
a.x = b
a.s = g
e.v = g
e.z = i
e.y = n
b.r = a
b.o = g
l.z = g
d.r = a
d.o = g
n.z = g
i.r = a
i.o = g
assert a.z.o.r.z.r.z.r.z.txt == "g"