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

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

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

a = A("a")
f = B("f")
l = C("l")
b = B("b")
n = A("n")
c = C("c")
e = A("e")
j = B("j")
k = C("k")

a.r = f
a.y = c
f.y = l
l.o = c
l.x = b
l.v = e
b.y = c
n.r = f
n.y = k
c.o = l
c.x = j
c.v = n
e.r = j
e.y = l
j.y = k
k.o = l
k.x = f
k.v = a
assert j.y.v.r.y.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
l = C("l")
b = B("b")
n = A("n")
c = C("c")
e = A("e")
j = B("j")
k = C("k")

a.r = f
a.y = c
f.y = l
l.o = c
l.x = b
l.v = e
b.y = c
n.r = f
n.y = k
c.o = l
c.x = j
c.v = n
e.r = j
e.y = l
j.y = k
k.o = l
k.x = f
k.v = a
assert j.y.v.r.y.x.y.x.txt == "j"