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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

e = A("e")
n = B("n")
c = C("c")
m = A("m")
b = B("b")
j = A("j")
f = B("f")

e.q = c
e.s = c
n.q = f
n.y = e
n.o = b
c.z = m
c.s = e
c.p = e
m.q = c
m.s = c
b.q = f
b.y = e
b.o = n
j.q = c
j.s = c
f.q = b
f.y = j
f.o = n
assert b.y.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

e = A("e")
n = B("n")
c = C("c")
m = A("m")
b = B("b")
j = A("j")
f = B("f")

e.q = c
e.s = c
n.q = f
n.y = e
n.o = b
c.z = m
c.s = e
c.p = e
m.q = c
m.s = c
b.q = f
b.y = e
b.o = n
j.q = c
j.s = c
f.q = b
f.y = j
f.o = n
assert b.y.q.p.txt == "e"