class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: E = None
        self.r: C = None
        self.x: C = 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.z: A = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.s: D = None
        self.o: D = None
        self.z: C = None
        self.txt = txt

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

g.t = j
g.r = j
g.x = j
g.s = f
l.r = f
j.z = g
j.q = f
i.y = j
f.w = l
f.p = g
f.s = i
f.o = i
f.z = j
assert i.y.z.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: E = None
        self.r: C = None
        self.x: C = 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.z: A = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.s: D = None
        self.o: D = None
        self.z: C = None
        self.txt = txt

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

g.t = j
g.r = j
g.x = j
g.s = f
l.r = f
j.z = g
j.q = f
i.y = j
f.w = l
f.p = g
f.s = i
f.o = i
f.z = j
assert i.y.z.s.p.txt == "g"