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

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

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

d = A("d")
l = B("l")
k = C("k")
j = C("j")
h = A("h")
e = C("e")
c = A("c")

d.s = k
l.y = k
k.v = d
k.q = d
j.v = h
j.q = d
h.s = e
e.v = h
e.q = h
c.s = k
assert e.v.s.v.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
k = C("k")
j = C("j")
h = A("h")
e = C("e")
c = A("c")

d.s = k
l.y = k
k.v = d
k.q = d
j.v = h
j.q = d
h.s = e
e.v = h
e.q = h
c.s = k
assert e.v.s.v.s.q.s.txt == "e"