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

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

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

l = A("l")
h = B("h")
f = C("f")
a = B("a")
i = A("i")
n = C("n")
d = B("d")
j = C("j")
g = A("g")

l.z = d
h.w = i
h.u = i
h.q = f
f.p = g
f.t = i
f.w = l
a.w = i
a.q = f
a.u = l
i.z = d
n.p = g
n.t = i
n.w = i
d.w = g
d.u = g
d.q = n
j.p = g
j.w = g
j.t = i
g.z = d
assert d.u.z.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
f = C("f")
a = B("a")
i = A("i")
n = C("n")
d = B("d")
j = C("j")
g = A("g")

l.z = d
h.w = i
h.u = i
h.q = f
f.p = g
f.t = i
f.w = l
a.w = i
a.q = f
a.u = l
i.z = d
n.p = g
n.t = i
n.w = i
d.w = g
d.u = g
d.q = n
j.p = g
j.w = g
j.t = i
g.z = d
assert d.u.z.q.p.txt == "g"