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

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

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

e = A("e")
i = B("i")
k = C("k")
m = B("m")
n = B("n")
g = B("g")
f = C("f")
j = C("j")

e.t = m
i.o = m
i.u = k
i.y = e
k.r = f
m.o = n
m.u = f
m.y = e
n.o = m
n.u = f
n.y = e
g.o = i
g.u = j
g.y = e
f.r = k
j.r = f
assert g.o.u.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
k = C("k")
m = B("m")
n = B("n")
g = B("g")
f = C("f")
j = C("j")

e.t = m
i.o = m
i.u = k
i.y = e
k.r = f
m.o = n
m.u = f
m.y = e
n.o = m
n.u = f
n.y = e
g.o = i
g.u = j
g.y = e
f.r = k
j.r = f
assert g.o.u.r.r.r.txt == "f"