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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.t: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
f = C("f")
e = D("e")
k = E("k")
i = F("i")

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.t: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
f = C("f")
e = D("e")
k = E("k")
i = F("i")

m.y = f
n.p = e
n.t = e
n.z = f
n.y = k
f.s = e
e.o = i
e.q = i
e.x = f
k.x = m
k.t = i
k.v = i
k.u = n
k.z = e
i.x = k
i.s = f
i.r = n
assert i.r.y.z.x.s.txt == "e"