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

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

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

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

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

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

m.x = n
m.u = k
l.q = n
l.o = k
l.t = k
l.v = m
k.u = n
k.q = l
k.s = l
k.p = l
e.r = c
e.q = d
e.v = l
e.y = n
n.t = l
n.p = m
d.r = n
d.q = f
d.v = l
d.y = c
c.t = l
c.p = m
f.r = n
f.y = n
f.q = e
f.v = l
assert f.q.q.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

m.x = n
m.u = k
l.q = n
l.o = k
l.t = k
l.v = m
k.u = n
k.q = l
k.s = l
k.p = l
e.r = c
e.q = d
e.v = l
e.y = n
n.t = l
n.p = m
d.r = n
d.q = f
d.v = l
d.y = c
c.t = l
c.p = m
f.r = n
f.y = n
f.q = e
f.v = l
assert f.q.q.q.v.txt == "l"