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

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

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

d = A("d")
f = B("f")
i = C("i")
l = B("l")
c = A("c")
e = C("e")
j = C("j")
h = A("h")
k = A("k")

d.r = l
d.u = k
d.q = c
f.w = j
i.x = j
i.q = e
i.z = f
l.w = i
c.r = f
c.u = h
c.q = k
e.x = j
e.q = i
e.z = l
j.x = i
j.q = i
j.z = l
h.r = f
h.u = c
h.q = c
k.r = l
k.u = h
k.q = h
assert c.r.w.z.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
i = C("i")
l = B("l")
c = A("c")
e = C("e")
j = C("j")
h = A("h")
k = A("k")

d.r = l
d.u = k
d.q = c
f.w = j
i.x = j
i.q = e
i.z = f
l.w = i
c.r = f
c.u = h
c.q = k
e.x = j
e.q = i
e.z = l
j.x = i
j.q = i
j.z = l
h.r = f
h.u = c
h.q = c
k.r = l
k.u = h
k.q = h
assert c.r.w.z.w.q.txt == "e"