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

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

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

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

a = A("a")
n = B("n")
k = C("k")
i = D("i")
h = A("h")
e = D("e")
c = B("c")

a.s = n
a.t = c
a.w = k
n.y = c
n.o = c
n.p = k
n.u = k
k.x = i
k.w = h
k.z = c
i.q = e
h.s = c
h.t = c
h.w = k
e.q = i
c.y = n
c.o = n
c.p = k
c.u = k
assert k.x.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.w: C = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
k = C("k")
i = D("i")
h = A("h")
e = D("e")
c = B("c")

a.s = n
a.t = c
a.w = k
n.y = c
n.o = c
n.p = k
n.u = k
k.x = i
k.w = h
k.z = c
i.q = e
h.s = c
h.t = c
h.w = k
e.q = i
c.y = n
c.o = n
c.p = k
c.u = k
assert k.x.q.q.q.q.txt == "i"