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

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

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

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

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

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

e.u = f
e.z = f
e.x = f
e.w = j
e.q = g
j.q = d
m.w = e
i.p = m
i.z = d
i.w = f
f.u = a
f.s = j
f.t = d
a.p = m
a.z = i
a.w = f
d.p = m
d.z = i
d.w = f
g.u = f
g.z = f
g.x = f
g.w = j
g.q = e
assert f.t.z.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: B = None
        self.q: A = None
        self.z: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

e.u = f
e.z = f
e.x = f
e.w = j
e.q = g
j.q = d
m.w = e
i.p = m
i.z = d
i.w = f
f.u = a
f.s = j
f.t = d
a.p = m
a.z = i
a.w = f
d.p = m
d.z = i
d.w = f
g.u = f
g.z = f
g.x = f
g.w = j
g.q = e
assert f.t.z.w.s.txt == "j"