class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

n.s = h
n.w = d
n.z = c
d.s = n
d.y = j
g.y = c
g.u = k
g.v = k
i.u = k
j.u = g
b.s = n
b.y = j
f.s = n
f.y = i
c.u = k
h.s = n
h.y = i
k.y = j
k.u = g
k.v = g
assert h.y.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

n.s = h
n.w = d
n.z = c
d.s = n
d.y = j
g.y = c
g.u = k
g.v = k
i.u = k
j.u = g
b.s = n
b.y = j
f.s = n
f.y = i
c.u = k
h.s = n
h.y = i
k.y = j
k.u = g
k.v = g
assert h.y.u.u.u.u.txt == "g"