class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: B = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

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

k = A("k")
h = B("h")
l = C("l")
m = D("m")
f = E("f")
n = F("n")
d = E("d")
i = C("i")

k.w = l
k.x = h
k.q = n
k.z = i
h.p = f
h.w = m
l.q = f
m.w = h
m.v = h
m.y = h
f.u = d
f.t = m
n.u = l
n.p = k
d.u = f
d.t = m
i.q = f
assert h.p.u.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: B = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

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

k = A("k")
h = B("h")
l = C("l")
m = D("m")
f = E("f")
n = F("n")
d = E("d")
i = C("i")

k.w = l
k.x = h
k.q = n
k.z = i
h.p = f
h.w = m
l.q = f
m.w = h
m.v = h
m.y = h
f.u = d
f.t = m
n.u = l
n.p = k
d.u = f
d.t = m
i.q = f
assert h.p.u.u.t.txt == "m"