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

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

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

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

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

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

e = A("e")
l = B("l")
m = C("m")
a = D("a")
d = E("d")
k = F("k")
n = F("n")

e.o = l
l.s = n
l.r = m
m.z = l
a.q = l
a.o = l
a.y = m
a.s = d
a.x = d
d.r = l
d.s = a
k.y = m
n.y = m
assert k.y.z.s.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

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

e = A("e")
l = B("l")
m = C("m")
a = D("a")
d = E("d")
k = F("k")
n = F("n")

e.o = l
l.s = n
l.r = m
m.z = l
a.q = l
a.o = l
a.y = m
a.s = d
a.x = d
d.r = l
d.s = a
k.y = m
n.y = m
assert k.y.z.s.y.z.txt == "l"