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

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

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

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

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

c = A("c")
d = B("d")
f = C("f")
e = D("e")
g = E("g")
a = C("a")
j = B("j")
i = B("i")
l = C("l")

c.s = f
c.r = a
d.t = e
f.u = c
f.z = c
e.z = c
g.t = c
g.z = l
g.x = j
a.u = c
a.z = c
j.t = e
i.t = e
l.u = c
l.z = c
assert g.z.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

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

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

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

c = A("c")
d = B("d")
f = C("f")
e = D("e")
g = E("g")
a = C("a")
j = B("j")
i = B("i")
l = C("l")

c.s = f
c.r = a
d.t = e
f.u = c
f.z = c
e.z = c
g.t = c
g.z = l
g.x = j
a.u = c
a.z = c
j.t = e
i.t = e
l.u = c
l.z = c
assert g.z.z.s.z.txt == "c"