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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: E = None
        self.x: E = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
m = C("m")
i = D("i")
n = E("n")
d = F("d")

k.y = d
c.v = m
m.p = d
m.u = n
m.x = n
i.s = m
i.w = k
i.x = c
n.v = k
n.w = k
d.s = i
assert m.u.w.y.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: E = None
        self.x: E = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
m = C("m")
i = D("i")
n = E("n")
d = F("d")

k.y = d
c.v = m
m.p = d
m.u = n
m.x = n
i.s = m
i.w = k
i.x = c
n.v = k
n.w = k
d.s = i
assert m.u.w.y.s.w.txt == "k"