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

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

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

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

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

g.o = i
l.s = n
l.t = i
k.u = n
k.o = l
k.t = l
k.z = h
n.w = k
n.t = k
n.s = l
n.p = g
i.s = n
i.t = l
h.u = n
h.o = l
h.t = l
h.z = k
assert k.z.t.s.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

g.o = i
l.s = n
l.t = i
k.u = n
k.o = l
k.t = l
k.z = h
n.w = k
n.t = k
n.s = l
n.p = g
i.s = n
i.t = l
h.u = n
h.o = l
h.t = l
h.z = k
assert k.z.t.s.s.t.s.txt == "n"