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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: B = None
        self.z: B = None
        self.v: A = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.u: A = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
n = C("n")
i = D("i")
a = E("a")
h = F("h")

m.t = a
m.u = k
k.r = a
n.y = a
n.q = k
n.z = k
n.v = m
n.t = m
n.w = m
i.t = m
i.u = m
i.w = m
i.r = n
i.y = n
a.v = k
h.r = k
h.x = k
h.y = i
assert n.t.t.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: B = None
        self.z: B = None
        self.v: A = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.u: A = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
n = C("n")
i = D("i")
a = E("a")
h = F("h")

m.t = a
m.u = k
k.r = a
n.y = a
n.q = k
n.z = k
n.v = m
n.t = m
n.w = m
i.t = m
i.u = m
i.w = m
i.r = n
i.y = n
a.v = k
h.r = k
h.x = k
h.y = i
assert n.t.t.v.r.v.txt == "k"