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

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

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

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

k = A("k")
d = B("d")
g = C("g")
m = D("m")
j = D("j")
c = C("c")
h = D("h")
e = B("e")

k.u = h
d.s = k
d.u = k
d.z = c
g.t = m
m.o = k
m.r = k
m.w = e
j.o = k
j.r = k
j.w = e
c.t = j
h.o = k
h.r = k
h.w = d
e.s = k
e.u = k
e.z = g
assert k.u.r.u.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
g = C("g")
m = D("m")
j = D("j")
c = C("c")
h = D("h")
e = B("e")

k.u = h
d.s = k
d.u = k
d.z = c
g.t = m
m.o = k
m.r = k
m.w = e
j.o = k
j.r = k
j.w = e
c.t = j
h.o = k
h.r = k
h.w = d
e.s = k
e.u = k
e.z = g
assert k.u.r.u.o.u.o.txt == "k"