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

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

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

j = A("j")
b = B("b")
f = C("f")
m = C("m")
g = B("g")
k = A("k")

j.o = f
j.r = f
j.x = g
b.y = m
f.r = m
f.s = m
f.v = g
m.r = f
m.s = f
m.v = b
g.y = f
k.o = m
k.r = f
k.x = b
assert j.o.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.x: B = None
        self.txt = txt

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

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

j = A("j")
b = B("b")
f = C("f")
m = C("m")
g = B("g")
k = A("k")

j.o = f
j.r = f
j.x = g
b.y = m
f.r = m
f.s = m
f.v = g
m.r = f
m.s = f
m.v = b
g.y = f
k.o = m
k.r = f
k.x = b
assert j.o.v.y.txt == "f"