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

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

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

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

j.o = n
j.t = a
l.w = n
a.w = c
a.u = n
a.x = d
n.o = j
n.t = a
d.w = l
d.u = n
d.x = a
c.w = j
m.w = c
m.u = j
m.x = b
b.w = l
b.u = n
b.x = d
assert l.w.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: C = None
        self.txt = txt

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

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

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

j.o = n
j.t = a
l.w = n
a.w = c
a.u = n
a.x = d
n.o = j
n.t = a
d.w = l
d.u = n
d.x = a
c.w = j
m.w = c
m.u = j
m.x = b
b.w = l
b.u = n
b.x = d
assert l.w.o.o.o.o.o.txt == "j"