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

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

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

f = A("f")
a = B("a")
k = C("k")
b = C("b")
c = B("c")
m = B("m")
e = B("e")

f.w = a
a.o = m
a.t = e
a.q = b
k.r = f
k.x = b
b.r = f
b.x = k
c.o = e
c.t = a
c.q = k
m.o = a
m.t = a
m.q = k
e.o = c
e.t = c
e.q = k
assert e.q.x.x.r.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
k = C("k")
b = C("b")
c = B("c")
m = B("m")
e = B("e")

f.w = a
a.o = m
a.t = e
a.q = b
k.r = f
k.x = b
b.r = f
b.x = k
c.o = e
c.t = a
c.q = k
m.o = a
m.t = a
m.q = k
e.o = c
e.t = c
e.q = k
assert e.q.x.x.r.w.q.txt == "b"