class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

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

h = A("h")
e = B("e")
a = C("a")
k = D("k")
n = B("n")
f = A("f")
g = D("g")

h.q = a
h.t = g
h.y = n
h.s = e
e.x = a
e.z = g
e.o = g
a.p = n
a.s = e
a.o = e
a.w = e
k.u = g
k.q = e
n.x = a
n.z = k
n.o = k
f.q = a
f.t = k
f.y = n
f.s = n
g.u = k
g.q = n
assert h.y.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

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

h = A("h")
e = B("e")
a = C("a")
k = D("k")
n = B("n")
f = A("f")
g = D("g")

h.q = a
h.t = g
h.y = n
h.s = e
e.x = a
e.z = g
e.o = g
a.p = n
a.s = e
a.o = e
a.w = e
k.u = g
k.q = e
n.x = a
n.z = k
n.o = k
f.q = a
f.t = k
f.y = n
f.s = n
g.u = k
g.q = n
assert h.y.o.q.o.txt == "g"