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

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

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

i = A("i")
k = B("k")
d = C("d")
f = C("f")
e = B("e")
l = B("l")

i.s = l
i.t = d
k.r = l
k.w = f
k.u = i
d.t = e
d.o = f
f.t = k
f.o = d
e.r = l
e.w = f
e.u = i
l.r = e
l.w = d
l.u = i
assert f.t.r.r.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
d = C("d")
f = C("f")
e = B("e")
l = B("l")

i.s = l
i.t = d
k.r = l
k.w = f
k.u = i
d.t = e
d.o = f
f.t = k
f.o = d
e.r = l
e.w = f
e.u = i
l.r = e
l.w = d
l.u = i
assert f.t.r.r.u.t.txt == "d"