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

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

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

a = A("a")
i = B("i")
h = C("h")
g = C("g")
k = B("k")
j = A("j")
c = C("c")
l = B("l")

a.r = j
a.w = j
a.z = k
i.p = j
i.v = k
i.x = a
h.p = a
g.p = j
k.p = a
k.x = a
k.v = l
j.r = a
j.w = a
j.z = k
c.p = j
l.p = j
l.x = j
l.v = i
assert a.w.w.w.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

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

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

a = A("a")
i = B("i")
h = C("h")
g = C("g")
k = B("k")
j = A("j")
c = C("c")
l = B("l")

a.r = j
a.w = j
a.z = k
i.p = j
i.v = k
i.x = a
h.p = a
g.p = j
k.p = a
k.x = a
k.v = l
j.r = a
j.w = a
j.z = k
c.p = j
l.p = j
l.x = j
l.v = i
assert a.w.w.w.z.v.txt == "l"