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

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

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

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

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

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

m.z = n
n.r = l
n.u = l
n.z = m
n.o = c
n.y = i
c.t = m
c.o = d
c.q = l
c.w = i
a.x = i
i.q = n
j.x = i
f.x = i
d.x = i
l.x = i
h.z = n
assert i.q.y.q.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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

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

m.z = n
n.r = l
n.u = l
n.z = m
n.o = c
n.y = i
c.t = m
c.o = d
c.q = l
c.w = i
a.x = i
i.q = n
j.x = i
f.x = i
d.x = i
l.x = i
h.z = n
assert i.q.y.q.z.z.txt == "n"