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

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

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

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

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

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

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

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

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

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

c.p = k
a.x = d
a.o = c
a.w = n
a.s = i
i.t = e
d.u = k
d.q = i
d.p = n
e.t = i
n.x = d
n.o = k
n.w = l
n.s = i
l.x = d
l.o = c
l.w = n
l.s = i
k.p = c
assert e.t.t.t.t.txt == "e"