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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: D = None
        self.o: B = None
        self.v: B = 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.s: C = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

a = A("a")
c = B("c")
k = C("k")
m = D("m")
n = C("n")
i = A("i")
j = B("j")
f = A("f")

a.q = n
a.x = n
a.o = k
a.t = j
c.s = m
c.t = m
c.o = j
c.v = j
k.t = m
m.s = k
m.r = j
m.t = c
n.t = m
i.q = k
i.o = n
i.x = n
i.t = c
j.s = m
j.t = m
j.o = c
j.v = c
f.q = n
f.o = n
f.x = n
f.t = j
assert n.t.t.t.r.t.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.x: C = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: D = None
        self.o: B = None
        self.v: B = 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.s: C = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

a = A("a")
c = B("c")
k = C("k")
m = D("m")
n = C("n")
i = A("i")
j = B("j")
f = A("f")

a.q = n
a.x = n
a.o = k
a.t = j
c.s = m
c.t = m
c.o = j
c.v = j
k.t = m
m.s = k
m.r = j
m.t = c
n.t = m
i.q = k
i.o = n
i.x = n
i.t = c
j.s = m
j.t = m
j.o = c
j.v = c
f.q = n
f.o = n
f.x = n
f.t = j
assert n.t.t.t.r.t.s.t.s.txt == "k"