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

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

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

n = A("n")
j = B("j")
a = C("a")
l = A("l")
e = A("e")
d = C("d")
c = A("c")
i = B("i")
f = A("f")

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

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

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

n = A("n")
j = B("j")
a = C("a")
l = A("l")
e = A("e")
d = C("d")
c = A("c")
i = B("i")
f = A("f")

n.q = j
n.w = f
n.u = f
j.u = n
a.x = e
a.t = d
l.q = j
l.w = n
l.u = f
e.q = j
e.w = f
e.u = n
d.x = e
d.t = a
c.q = j
c.w = f
c.u = f
i.u = e
f.q = i
f.w = l
f.u = l
assert e.q.u.w.u.q.u.q.txt == "j"