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

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

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

e = A("e")
d = B("d")
m = C("m")
k = B("k")
b = C("b")
c = B("c")
n = B("n")
g = A("g")
h = A("h")
l = A("l")

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

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

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

e = A("e")
d = B("d")
m = C("m")
k = B("k")
b = C("b")
c = B("c")
n = B("n")
g = A("g")
h = A("h")
l = A("l")

e.y = c
d.v = h
d.u = b
m.x = h
m.q = d
k.v = l
k.u = b
b.x = g
b.q = n
c.v = h
c.u = b
n.v = g
n.u = m
g.y = k
h.y = c
l.y = d
assert h.y.u.x.y.v.y.v.y.u.txt == "b"