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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.x: B = None
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.x: B = None
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

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

m.t = n
g.s = i
g.x = d
g.q = j
j.w = d
j.s = i
i.u = l
i.p = n
i.x = f
i.z = m
i.t = m
n.z = m
n.v = m
l.u = i
l.p = n
l.x = g
l.z = m
l.t = m
d.z = m
d.v = m
f.s = l
f.x = d
f.q = j
assert j.w.v.t.v.txt == "m"