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

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

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

f = A("f")
i = B("i")
a = C("a")
b = C("b")
d = B("d")
j = B("j")
g = B("g")

f.r = j
i.y = f
i.v = f
i.r = j
a.s = f
a.y = f
a.w = b
b.s = f
b.y = f
b.w = a
d.y = f
d.v = f
d.r = i
j.y = f
j.v = f
j.r = i
g.y = f
g.v = f
g.r = i
assert a.w.s.r.r.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
a = C("a")
b = C("b")
d = B("d")
j = B("j")
g = B("g")

f.r = j
i.y = f
i.v = f
i.r = j
a.s = f
a.y = f
a.w = b
b.s = f
b.y = f
b.w = a
d.y = f
d.v = f
d.r = i
j.y = f
j.v = f
j.r = i
g.y = f
g.v = f
g.r = i
assert a.w.s.r.r.y.r.v.txt == "f"