class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.p: C = None
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = None
        self.w: D = None
        self.r: D = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = None
        self.w: D = None
        self.r: D = None
        self.t: D = None
        self.txt = txt

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

g.x = b
g.w = c
g.p = c
g.s = a
g.q = a
a.z = g
a.q = m
c.t = g
e.s = b
m.y = e
m.w = e
m.r = e
m.t = e
m.x = g
j.t = g
b.t = g
assert j.t.s.q.t.s.t.x.txt == "b"