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

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

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

f = A("f")
d = B("d")
m = C("m")
c = B("c")
h = B("h")
k = A("k")
n = A("n")
g = C("g")
l = C("l")
i = A("i")

f.t = k
f.s = k
d.x = h
d.s = g
d.v = n
m.o = c
c.x = d
c.s = m
c.v = n
h.x = d
h.s = l
h.v = n
k.t = n
k.s = i
n.t = i
n.s = k
g.o = d
l.o = d
i.t = f
i.s = k
assert g.o.v.t.s.s.s.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: A = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
m = C("m")
c = B("c")
h = B("h")
k = A("k")
n = A("n")
g = C("g")
l = C("l")
i = A("i")

f.t = k
f.s = k
d.x = h
d.s = g
d.v = n
m.o = c
c.x = d
c.s = m
c.v = n
h.x = d
h.s = l
h.v = n
k.t = n
k.s = i
n.t = i
n.s = k
g.o = d
l.o = d
i.t = f
i.s = k
assert g.o.v.t.s.s.s.s.t.txt == "f"