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

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

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

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

a = A("a")
f = B("f")
k = C("k")
b = D("b")
l = A("l")
e = B("e")
n = C("n")
c = A("c")

a.y = c
a.s = l
a.p = b
a.v = b
f.w = c
f.q = b
k.s = n
k.t = n
b.s = e
b.w = f
l.y = c
l.s = a
l.p = b
l.v = b
e.w = l
e.q = b
n.s = k
n.t = k
c.y = a
c.s = a
c.p = b
c.v = b
assert n.s.t.s.s.s.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

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

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

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

a = A("a")
f = B("f")
k = C("k")
b = D("b")
l = A("l")
e = B("e")
n = C("n")
c = A("c")

a.y = c
a.s = l
a.p = b
a.v = b
f.w = c
f.q = b
k.s = n
k.t = n
b.s = e
b.w = f
l.y = c
l.s = a
l.p = b
l.v = b
e.w = l
e.q = b
n.s = k
n.t = k
c.y = a
c.s = a
c.p = b
c.v = b
assert n.s.t.s.s.s.s.t.s.txt == "n"