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

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

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

e = A("e")
l = B("l")
d = C("d")
i = C("i")
c = A("c")
h = B("h")
a = C("a")

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

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

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

e = A("e")
l = B("l")
d = C("d")
i = C("i")
c = A("c")
h = B("h")
a = C("a")

e.v = l
e.x = l
e.z = d
l.x = e
l.q = a
l.u = a
d.r = c
d.w = a
i.r = e
i.w = a
c.v = h
c.x = l
c.z = d
h.x = e
h.q = i
h.u = a
a.r = e
a.w = i
assert c.z.w.r.x.q.r.txt == "e"