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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
j = C("j")
g = D("g")
l = E("l")
n = E("n")
i = C("i")
f = B("f")

c.z = f
b.z = g
b.r = g
b.w = g
b.t = g
j.x = f
j.q = f
j.y = i
g.o = l
l.t = c
n.t = c
i.x = f
i.q = b
i.y = j
f.z = g
f.r = g
f.w = g
f.t = g
assert j.y.y.y.x.z.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
j = C("j")
g = D("g")
l = E("l")
n = E("n")
i = C("i")
f = B("f")

c.z = f
b.z = g
b.r = g
b.w = g
b.t = g
j.x = f
j.q = f
j.y = i
g.o = l
l.t = c
n.t = c
i.x = f
i.q = b
i.y = j
f.z = g
f.r = g
f.w = g
f.t = g
assert j.y.y.y.x.z.o.t.txt == "c"