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

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

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

h = A("h")
l = B("l")
j = C("j")
d = B("d")
g = A("g")
e = B("e")

h.u = d
h.s = j
h.t = l
l.r = e
l.q = j
l.w = d
j.z = e
j.r = d
d.r = e
d.w = e
d.q = j
g.u = e
g.s = j
g.t = l
e.r = l
e.w = l
e.q = j
assert d.w.w.r.q.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: C = None
        self.t: B = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
j = C("j")
d = B("d")
g = A("g")
e = B("e")

h.u = d
h.s = j
h.t = l
l.r = e
l.q = j
l.w = d
j.z = e
j.r = d
d.r = e
d.w = e
d.q = j
g.u = e
g.s = j
g.t = l
e.r = l
e.w = l
e.q = j
assert d.w.w.r.q.z.w.txt == "l"