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

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

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

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

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

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

l.q = j
l.w = j
l.z = k
l.y = e
d.r = a
b.z = e
b.s = e
b.p = k
b.v = j
k.t = m
e.w = k
e.o = d
m.t = k
i.r = d
a.r = d
f.r = d
j.q = l
j.w = l
j.z = m
j.y = e
assert m.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: D = None
        self.y: E = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

l.q = j
l.w = j
l.z = k
l.y = e
d.r = a
b.z = e
b.s = e
b.p = k
b.v = j
k.t = m
e.w = k
e.o = d
m.t = k
i.r = d
a.r = d
f.r = d
j.q = l
j.w = l
j.z = m
j.y = e
assert m.t.t.t.t.txt == "m"