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

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

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

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

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

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

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

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

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

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

k.u = a
k.t = a
k.p = c
d.p = n
d.o = a
d.x = c
m.p = k
i.p = l
i.r = k
i.w = k
i.o = d
c.u = a
c.t = d
c.p = k
n.p = c
g.p = c
a.p = g
a.o = d
a.x = c
l.p = i
l.r = k
l.w = k
l.o = a
assert c.t.p.p.u.txt == "a"