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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.txt = txt

j = A("j")
n = B("n")
d = C("d")
m = D("m")
c = E("c")
i = E("i")
a = E("a")

j.q = d
n.w = d
n.o = m
n.z = m
n.v = a
n.r = a
d.q = m
m.o = d
m.q = d
m.w = d
m.t = j
m.s = j
c.o = d
c.x = j
i.o = d
i.x = j
a.o = d
a.x = j
assert a.x.q.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.txt = txt

j = A("j")
n = B("n")
d = C("d")
m = D("m")
c = E("c")
i = E("i")
a = E("a")

j.q = d
n.w = d
n.o = m
n.z = m
n.v = a
n.r = a
d.q = m
m.o = d
m.q = d
m.w = d
m.t = j
m.s = j
c.o = d
c.x = j
i.o = d
i.x = j
a.o = d
a.x = j
assert a.x.q.q.t.txt == "j"