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

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

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

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

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

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

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

h.v = l
h.r = a
i.q = l
a.u = i
a.z = m
a.x = h
a.p = c
n.t = i
n.r = i
n.p = h
n.q = h
n.s = h
n.x = c
m.t = h
c.w = m
c.z = l
f.t = i
f.r = i
f.p = h
f.q = h
f.s = h
f.x = c
l.t = i
l.r = i
l.p = h
l.q = h
l.s = h
l.x = c
assert i.q.x.z.r.q.t.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

h.v = l
h.r = a
i.q = l
a.u = i
a.z = m
a.x = h
a.p = c
n.t = i
n.r = i
n.p = h
n.q = h
n.s = h
n.x = c
m.t = h
c.w = m
c.z = l
f.t = i
f.r = i
f.p = h
f.q = h
f.s = h
f.x = c
l.t = i
l.r = i
l.p = h
l.q = h
l.s = h
l.x = c
assert i.q.x.z.r.q.t.q.q.txt == "h"