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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: C = None
        self.r: C = None
        self.y: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: C = None
        self.r: C = None
        self.y: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

e.r = l
i.q = l
i.p = d
i.r = d
i.y = e
i.v = e
d.y = i
d.x = f
f.v = e
f.z = l
f.r = l
f.p = k
k.z = e
k.o = e
k.t = e
k.q = m
k.p = f
l.v = e
l.z = f
l.r = f
l.p = k
m.y = i
m.x = l
assert f.z.v.r.p.q.x.txt == "l"