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

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

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

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

e.u = a
e.r = d
m.w = a
m.t = g
m.v = g
d.x = g
a.u = e
a.r = d
b.u = a
b.r = h
h.x = m
g.w = e
g.t = m
g.v = m
k.x = m
l.x = g
assert d.x.t.v.w.r.x.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: C = None
        self.txt = txt

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

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

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

e.u = a
e.r = d
m.w = a
m.t = g
m.v = g
d.x = g
a.u = e
a.r = d
b.u = a
b.r = h
h.x = m
g.w = e
g.t = m
g.v = m
k.x = m
l.x = g
assert d.x.t.v.w.r.x.t.w.txt == "a"