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

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

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

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

n.r = b
i.q = k
i.z = e
i.y = b
k.r = e
k.z = b
b.q = e
b.z = k
b.y = i
e.r = k
e.z = i
assert n.r.z.r.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

n.r = b
i.q = k
i.z = e
i.y = b
k.r = e
k.z = b
b.q = e
b.z = k
b.y = i
e.r = k
e.z = i
assert n.r.z.r.z.y.txt == "b"