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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.txt = txt

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

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

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

i.s = k
c.y = l
c.q = l
k.q = c
k.u = c
k.x = d
k.t = l
a.x = g
f.x = j
j.s = k
d.s = k
l.y = c
l.q = c
n.s = k
g.s = k
assert d.s.t.y.q.q.q.q.q.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.txt = txt

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

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

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

i.s = k
c.y = l
c.q = l
k.q = c
k.u = c
k.x = d
k.t = l
a.x = g
f.x = j
j.s = k
d.s = k
l.y = c
l.q = c
n.s = k
g.s = k
assert d.s.t.y.q.q.q.q.q.y.y.txt == "l"