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

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

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

h = A("h")
n = B("n")
e = C("e")
l = B("l")
b = A("b")
d = C("d")
i = B("i")

h.u = l
h.t = l
h.v = b
n.v = h
n.x = i
e.y = h
e.q = d
e.v = d
l.v = b
l.x = n
b.u = n
b.t = n
b.v = h
d.y = b
d.q = e
d.v = e
i.v = b
i.x = l
assert d.v.y.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.v: A = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
e = C("e")
l = B("l")
b = A("b")
d = C("d")
i = B("i")

h.u = l
h.t = l
h.v = b
n.v = h
n.x = i
e.y = h
e.q = d
e.v = d
l.v = b
l.x = n
b.u = n
b.t = n
b.v = h
d.y = b
d.q = e
d.v = e
i.v = b
i.x = l
assert d.v.y.u.v.u.txt == "n"