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

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

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

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

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

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

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

d.y = a
a.p = d
a.t = m
a.o = m
a.u = m
a.y = c
k.r = m
k.p = d
k.q = d
k.z = d
i.s = c
m.s = a
c.y = d
f.r = m
f.p = d
f.q = d
f.z = d
l.s = b
b.y = d
assert i.s.y.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

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

d.y = a
a.p = d
a.t = m
a.o = m
a.u = m
a.y = c
k.r = m
k.p = d
k.q = d
k.z = d
i.s = c
m.s = a
c.y = d
f.r = m
f.p = d
f.q = d
f.z = d
l.s = b
b.y = d
assert i.s.y.y.o.txt == "m"