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

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

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

i = A("i")
e = B("e")
a = C("a")
n = A("n")
d = B("d")

i.q = n
i.u = n
i.t = e
e.u = n
e.y = n
e.w = i
a.u = n
a.x = i
a.p = i
n.q = i
n.u = i
n.t = d
d.u = i
d.y = n
d.w = n
assert e.y.t.u.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

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

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

i = A("i")
e = B("e")
a = C("a")
n = A("n")
d = B("d")

i.q = n
i.u = n
i.t = e
e.u = n
e.y = n
e.w = i
a.u = n
a.x = i
a.p = i
n.q = i
n.u = i
n.t = d
d.u = i
d.y = n
d.w = n
assert e.y.t.u.u.t.txt == "d"