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

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

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

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

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

g = A("g")
e = B("e")
j = C("j")
k = D("k")
b = E("b")
c = A("c")
i = A("i")
m = E("m")

g.t = e
e.x = m
j.q = c
j.w = k
j.t = k
j.p = b
j.s = i
k.t = j
b.t = j
c.t = e
i.t = e
m.t = j
assert j.t.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

g = A("g")
e = B("e")
j = C("j")
k = D("k")
b = E("b")
c = A("c")
i = A("i")
m = E("m")

g.t = e
e.x = m
j.q = c
j.w = k
j.t = k
j.p = b
j.s = i
k.t = j
b.t = j
c.t = e
i.t = e
m.t = j
assert j.t.t.s.t.txt == "e"