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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: F = None
        self.v: C = None
        self.q: E = None
        self.u: F = None
        self.y: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.s: D = None
        self.x: B = None
        self.y: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: F = None
        self.v: C = None
        self.q: E = None
        self.u: F = None
        self.y: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.s: D = None
        self.x: B = None
        self.y: D = None
        self.txt = txt

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

m.z = d
h.s = d
e.t = k
k.p = m
k.o = n
k.u = n
k.y = n
k.v = e
k.q = c
c.q = h
c.p = m
c.o = n
n.u = h
n.x = h
n.w = k
n.s = k
n.y = k
d.t = k
assert k.v.t.v.t.p.z.t.txt == "k"