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

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

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

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

k.y = c
k.o = c
b.x = c
b.q = j
b.w = e
c.y = f
c.p = b
e.x = c
e.q = b
e.w = b
i.y = f
i.o = f
j.x = c
j.q = e
j.w = b
f.y = c
f.p = b
assert b.q.x.p.q.x.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: C = None
        self.txt = txt

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

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

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

k.y = c
k.o = c
b.x = c
b.q = j
b.w = e
c.y = f
c.p = b
e.x = c
e.q = b
e.w = b
i.y = f
i.o = f
j.x = c
j.q = e
j.w = b
f.y = c
f.p = b
assert b.q.x.p.q.x.y.y.txt == "c"