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

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

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

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

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

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

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

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

c.o = h
c.v = k
c.r = j
f.t = j
f.y = l
j.r = b
n.o = c
n.v = l
n.r = b
i.t = k
i.y = k
h.o = e
h.v = l
h.r = b
k.r = l
e.o = c
e.v = k
e.r = l
l.r = j
b.r = j
assert f.t.r.r.txt == "j"