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

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

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

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

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

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

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

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

g.u = l
g.w = e
g.s = h
h.z = k
h.p = d
e.u = g
k.z = h
k.p = a
d.u = l
d.w = l
d.s = k
j.u = e
j.w = e
j.s = h
l.u = a
a.u = l
a.w = l
a.s = h
assert e.u.w.u.u.u.w.u.txt == "a"