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

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

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

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

k = A("k")
m = B("m")
n = C("n")
j = D("j")
b = A("b")
d = A("d")
c = A("c")
h = B("h")
i = D("i")
a = C("a")

k.y = n
k.w = h
k.p = a
m.t = a
m.r = d
m.u = h
m.z = n
n.r = b
n.s = a
j.y = i
b.y = a
b.w = h
b.p = n
d.y = a
d.w = h
d.p = n
c.y = n
c.p = n
c.w = m
h.t = n
h.z = n
h.r = b
h.u = m
i.y = j
a.r = c
a.s = n
assert k.y.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.p: C = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
n = C("n")
j = D("j")
b = A("b")
d = A("d")
c = A("c")
h = B("h")
i = D("i")
a = C("a")

k.y = n
k.w = h
k.p = a
m.t = a
m.r = d
m.u = h
m.z = n
n.r = b
n.s = a
j.y = i
b.y = a
b.w = h
b.p = n
d.y = a
d.w = h
d.p = n
c.y = n
c.p = n
c.w = m
h.t = n
h.z = n
h.r = b
h.u = m
i.y = j
a.r = c
a.s = n
assert k.y.r.w.txt == "h"