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

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

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

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

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

b.p = l
b.s = l
b.o = c
c.o = n
a.t = n
n.v = i
l.t = n
m.p = l
m.s = l
m.o = c
k.p = l
k.s = l
k.o = c
i.p = a
i.s = a
i.o = c
assert k.s.t.v.s.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.s: C = None
        self.txt = txt

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

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

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

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

b.p = l
b.s = l
b.o = c
c.o = n
a.t = n
n.v = i
l.t = n
m.p = l
m.s = l
m.o = c
k.p = l
k.s = l
k.o = c
i.p = a
i.s = a
i.o = c
assert k.s.t.v.s.t.v.txt == "i"