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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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