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

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

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

a = A("a")
n = B("n")
k = C("k")
c = A("c")
j = B("j")
e = C("e")
i = C("i")

a.p = i
a.y = i
a.v = n
n.w = j
k.q = i
k.v = i
k.w = n
c.p = k
c.y = i
c.v = j
j.w = n
e.q = i
e.v = i
e.w = n
i.q = k
i.w = n
i.v = e
assert i.v.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: C = None
        self.v: B = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
k = C("k")
c = A("c")
j = B("j")
e = C("e")
i = C("i")

a.p = i
a.y = i
a.v = n
n.w = j
k.q = i
k.v = i
k.w = n
c.p = k
c.y = i
c.v = j
j.w = n
e.q = i
e.v = i
e.w = n
i.q = k
i.w = n
i.v = e
assert i.v.w.w.w.w.txt == "j"