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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: F = None
        self.q: D = None
        self.y: A = None
        self.x: D = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: F = None
        self.u: A = None
        self.v: F = None
        self.z: F = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
k = C("k")
i = D("i")
c = E("c")
b = F("b")

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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: F = None
        self.q: D = None
        self.y: A = None
        self.x: D = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: F = None
        self.u: A = None
        self.v: F = None
        self.z: F = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
k = C("k")
i = D("i")
c = E("c")
b = F("b")

e.y = i
m.t = k
m.u = b
m.q = i
m.x = i
m.y = e
m.o = e
k.r = c
k.t = e
i.w = b
i.t = b
i.v = b
i.z = b
i.u = e
c.t = e
b.q = k
assert k.r.t.y.txt == "i"