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

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

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

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

f.x = k
f.q = k
f.s = k
k.o = d
d.y = f
d.q = k
d.x = m
b.x = k
b.q = m
b.s = m
m.o = h
h.y = b
h.q = c
h.x = m
c.o = d
assert b.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.s: B = None
        self.txt = txt

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

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

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

f.x = k
f.q = k
f.s = k
k.o = d
d.y = f
d.q = k
d.x = m
b.x = k
b.q = m
b.s = m
m.o = h
h.y = b
h.q = c
h.x = m
c.o = d
assert b.x.o.x.txt == "m"