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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.w: A = None
        self.txt = txt

f = A("f")
j = B("j")
b = C("b")
k = B("k")
e = A("e")
c = A("c")
d = C("d")
a = B("a")
m = A("m")

f.s = e
f.v = c
j.y = a
b.t = d
b.z = e
b.w = m
k.y = j
e.s = f
e.v = c
c.s = m
c.v = e
d.t = b
d.z = m
d.w = c
a.y = j
m.s = c
m.v = c
assert d.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.w: A = None
        self.txt = txt

f = A("f")
j = B("j")
b = C("b")
k = B("k")
e = A("e")
c = A("c")
d = C("d")
a = B("a")
m = A("m")

f.s = e
f.v = c
j.y = a
b.t = d
b.z = e
b.w = m
k.y = j
e.s = f
e.v = c
c.s = m
c.v = e
d.t = b
d.z = m
d.w = c
a.y = j
m.s = c
m.v = c
assert d.z.s.s.txt == "m"