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

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

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

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

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

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

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

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

j.y = h
j.x = h
j.r = l
f.t = n
f.s = c
f.v = l
l.o = m
l.w = m
l.t = h
a.y = l
a.x = l
a.r = h
k.t = n
k.s = j
k.v = l
c.y = h
c.x = h
c.r = l
m.t = a
m.s = a
m.v = h
h.o = k
h.t = l
h.w = b
n.y = h
n.r = h
n.x = l
b.t = n
b.s = c
b.v = h
assert j.r.t.o.t.txt == "n"