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

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

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

b = A("b")
e = B("e")
c = C("c")
n = B("n")
m = C("m")
j = B("j")
a = A("a")
l = C("l")
i = A("i")

b.y = i
b.w = m
e.s = j
c.r = i
c.t = a
n.s = j
m.r = a
m.t = a
j.s = e
a.y = i
a.w = m
l.r = i
l.t = a
i.y = a
i.w = c
assert i.y.w.r.y.w.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
c = C("c")
n = B("n")
m = C("m")
j = B("j")
a = A("a")
l = C("l")
i = A("i")

b.y = i
b.w = m
e.s = j
c.r = i
c.t = a
n.s = j
m.r = a
m.t = a
j.s = e
a.y = i
a.w = m
l.r = i
l.t = a
i.y = a
i.w = c
assert i.y.w.r.y.w.r.y.txt == "a"