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

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

b = A("b")
f = B("f")
c = A("c")
l = A("l")
a = B("a")
h = B("h")
g = B("g")

b.r = l
f.v = b
f.t = b
c.r = b
l.r = c
a.v = b
a.t = l
h.v = b
h.t = l
g.v = l
g.t = c
assert c.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

b = A("b")
f = B("f")
c = A("c")
l = A("l")
a = B("a")
h = B("h")
g = B("g")

b.r = l
f.v = b
f.t = b
c.r = b
l.r = c
a.v = b
a.t = l
h.v = b
h.t = l
g.v = l
g.t = c
assert c.r.r.r.txt == "c"