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

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

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

f = A("f")
h = B("h")
d = C("d")
b = C("b")
l = B("l")
a = A("a")
j = B("j")
n = C("n")
e = B("e")
m = A("m")

f.y = l
f.v = a
f.t = n
h.s = e
d.y = f
d.z = e
d.s = h
b.y = a
b.z = e
b.s = e
l.s = h
a.y = j
a.v = f
a.t = n
j.s = h
n.y = f
n.z = l
n.s = h
e.s = h
m.y = e
m.v = f
m.t = b
assert l.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
d = C("d")
b = C("b")
l = B("l")
a = A("a")
j = B("j")
n = C("n")
e = B("e")
m = A("m")

f.y = l
f.v = a
f.t = n
h.s = e
d.y = f
d.z = e
d.s = h
b.y = a
b.z = e
b.s = e
l.s = h
a.y = j
a.v = f
a.t = n
j.s = h
n.y = f
n.z = l
n.s = h
e.s = h
m.y = e
m.v = f
m.t = b
assert l.s.s.s.s.s.s.s.txt == "h"