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

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

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

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

k = A("k")
g = B("g")
l = C("l")
h = D("h")
n = D("n")
b = B("b")
i = D("i")
c = C("c")

k.o = c
k.s = b
k.r = h
k.z = h
g.o = l
l.o = c
l.x = h
h.w = b
h.t = g
n.w = g
n.t = g
b.o = c
i.w = b
i.t = g
c.o = l
c.x = n
assert g.o.o.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: B = None
        self.r: D = None
        self.z: D = None
        self.txt = txt

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

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

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

k = A("k")
g = B("g")
l = C("l")
h = D("h")
n = D("n")
b = B("b")
i = D("i")
c = C("c")

k.o = c
k.s = b
k.r = h
k.z = h
g.o = l
l.o = c
l.x = h
h.w = b
h.t = g
n.w = g
n.t = g
b.o = c
i.w = b
i.t = g
c.o = l
c.x = n
assert g.o.o.x.w.txt == "g"