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

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

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

c = A("c")
n = B("n")
d = C("d")
h = A("h")
i = B("i")

c.q = d
c.s = n
c.v = h
n.w = h
n.x = c
n.u = c
d.t = c
d.z = n
h.q = d
h.s = n
h.v = c
i.w = h
i.x = c
i.u = c
assert i.x.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: B = None
        self.v: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
d = C("d")
h = A("h")
i = B("i")

c.q = d
c.s = n
c.v = h
n.w = h
n.x = c
n.u = c
d.t = c
d.z = n
h.q = d
h.s = n
h.v = c
i.w = h
i.x = c
i.u = c
assert i.x.q.t.txt == "c"