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

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

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

g = A("g")
l = B("l")
b = C("b")
f = C("f")
e = A("e")

g.r = l
l.p = g
l.s = g
l.v = f
b.u = g
b.t = e
f.u = g
f.t = e
e.r = l
assert l.v.t.r.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
b = C("b")
f = C("f")
e = A("e")

g.r = l
l.p = g
l.s = g
l.v = f
b.u = g
b.t = e
f.u = g
f.t = e
e.r = l
assert l.v.t.r.v.t.txt == "e"