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

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

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

c = A("c")
h = B("h")
i = C("i")
f = A("f")
n = A("n")
b = B("b")
k = C("k")
d = C("d")

c.x = h
c.o = h
c.w = f
h.s = d
i.v = b
f.x = h
f.o = h
f.w = c
n.x = h
n.o = h
n.w = f
b.s = k
k.v = h
d.v = b
assert i.v.s.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: B = None
        self.w: A = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
i = C("i")
f = A("f")
n = A("n")
b = B("b")
k = C("k")
d = C("d")

c.x = h
c.o = h
c.w = f
h.s = d
i.v = b
f.x = h
f.o = h
f.w = c
n.x = h
n.o = h
n.w = f
b.s = k
k.v = h
d.v = b
assert i.v.s.v.s.v.txt == "b"