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

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

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

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

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

k.r = e
k.t = e
k.x = e
k.s = n
l.o = e
l.r = i
l.w = k
g.p = e
g.s = e
g.t = k
g.y = i
e.w = n
i.o = e
i.r = l
i.w = n
n.r = e
n.t = e
n.x = e
n.s = k
assert k.t.w.t.w.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

k.r = e
k.t = e
k.x = e
k.s = n
l.o = e
l.r = i
l.w = k
g.p = e
g.s = e
g.t = k
g.y = i
e.w = n
i.o = e
i.r = l
i.w = n
n.r = e
n.t = e
n.x = e
n.s = k
assert k.t.w.t.w.s.t.txt == "e"