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

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

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

j = A("j")
k = B("k")
e = C("e")
b = C("b")
h = B("h")
i = C("i")

j.o = k
k.t = j
k.v = i
k.r = h
e.v = h
e.y = h
e.x = j
b.v = h
b.y = h
b.x = j
h.t = j
h.v = b
h.r = k
i.v = k
i.x = j
i.y = h
assert e.v.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
e = C("e")
b = C("b")
h = B("h")
i = C("i")

j.o = k
k.t = j
k.v = i
k.r = h
e.v = h
e.y = h
e.x = j
b.v = h
b.y = h
b.x = j
h.t = j
h.v = b
h.r = k
i.v = k
i.x = j
i.y = h
assert e.v.r.r.txt == "h"