class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: B = None
        self.w: E = None
        self.q: F = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

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

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

k.x = n
k.v = n
k.w = m
k.q = h
k.r = j
n.t = h
i.x = e
i.z = k
i.w = k
i.t = j
i.q = j
i.v = j
j.p = i
m.y = n
h.q = n
e.x = i
e.z = k
e.w = k
e.t = j
e.q = j
e.v = j
assert n.t.q.t.q.t.q.t.txt == "h"