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

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

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

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

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

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

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

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

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

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

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

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

f.y = m
e.y = l
e.o = m
e.u = k
m.v = l
m.p = l
m.r = l
m.z = i
k.x = m
k.q = i
l.w = i
i.y = l
i.o = m
i.u = k
c.y = m
assert k.q.u.x.r.txt == "l"