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

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

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

l = A("l")
h = B("h")
d = C("d")
k = C("k")
b = C("b")
g = B("g")
n = A("n")
f = A("f")
j = A("j")

l.z = f
l.t = j
h.z = k
h.x = g
h.v = f
d.w = k
d.s = f
k.w = b
k.s = j
b.w = k
b.s = n
g.z = b
g.x = h
g.v = f
n.z = l
n.t = j
f.z = j
f.t = n
j.z = n
j.t = n
assert f.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
d = C("d")
k = C("k")
b = C("b")
g = B("g")
n = A("n")
f = A("f")
j = A("j")

l.z = f
l.t = j
h.z = k
h.x = g
h.v = f
d.w = k
d.s = f
k.w = b
k.s = j
b.w = k
b.s = n
g.z = b
g.x = h
g.v = f
n.z = l
n.t = j
f.z = j
f.t = n
j.z = n
j.t = n
assert f.t.t.t.t.txt == "j"