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

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

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

j = A("j")
c = B("c")
a = C("a")
e = A("e")
l = B("l")
d = B("d")

j.y = c
c.r = a
c.o = a
c.s = j
a.o = e
a.y = j
a.s = j
e.y = l
l.r = a
l.o = a
l.s = e
d.r = a
d.o = a
d.s = e
assert c.o.s.y.r.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
a = C("a")
e = A("e")
l = B("l")
d = B("d")

j.y = c
c.r = a
c.o = a
c.s = j
a.o = e
a.y = j
a.s = j
e.y = l
l.r = a
l.o = a
l.s = e
d.r = a
d.o = a
d.s = e
assert c.o.s.y.r.o.y.txt == "l"