class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: 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: B = None
        self.s: B = None
        self.z: C = None
        self.txt = txt

e = A("e")
n = B("n")
h = C("h")
b = C("b")
f = C("f")
j = C("j")
g = B("g")
l = A("l")

e.q = g
e.v = l
n.u = l
h.x = g
h.s = n
h.z = j
b.x = g
b.s = g
b.z = h
f.x = g
f.s = n
f.z = j
j.x = n
j.s = g
j.z = h
g.u = l
l.q = g
l.v = e
assert n.u.q.u.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: 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: B = None
        self.s: B = None
        self.z: C = None
        self.txt = txt

e = A("e")
n = B("n")
h = C("h")
b = C("b")
f = C("f")
j = C("j")
g = B("g")
l = A("l")

e.q = g
e.v = l
n.u = l
h.x = g
h.s = n
h.z = j
b.x = g
b.s = g
b.z = h
f.x = g
f.s = n
f.z = j
j.x = n
j.s = g
j.z = h
g.u = l
l.q = g
l.v = e
assert n.u.q.u.v.v.v.v.txt == "l"