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

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

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

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

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

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

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

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

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