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

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

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

f = A("f")
e = B("e")
g = C("g")
d = B("d")
k = C("k")
b = C("b")
n = A("n")
c = B("c")

f.u = d
f.v = k
f.s = n
e.t = g
g.o = f
d.t = k
k.o = n
b.o = n
n.u = e
n.v = g
n.s = f
c.t = k
assert k.o.u.t.o.u.t.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: C = None
        self.s: A = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
g = C("g")
d = B("d")
k = C("k")
b = C("b")
n = A("n")
c = B("c")

f.u = d
f.v = k
f.s = n
e.t = g
g.o = f
d.t = k
k.o = n
b.o = n
n.u = e
n.v = g
n.s = f
c.t = k
assert k.o.u.t.o.u.t.o.s.txt == "f"