class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: D = None
        self.q: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

k = A("k")
m = B("m")
c = C("c")
n = D("n")
h = E("h")
g = F("g")

k.z = g
k.r = n
k.q = m
k.t = c
m.v = c
m.u = k
m.w = g
m.t = g
c.r = n
c.z = n
n.t = k
n.w = h
h.v = m
h.u = g
h.s = n
g.p = h
assert m.v.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: D = None
        self.q: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

k = A("k")
m = B("m")
c = C("c")
n = D("n")
h = E("h")
g = F("g")

k.z = g
k.r = n
k.q = m
k.t = c
m.v = c
m.u = k
m.w = g
m.t = g
c.r = n
c.z = n
n.t = k
n.w = h
h.v = m
h.u = g
h.s = n
g.p = h
assert m.v.z.t.txt == "k"