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

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

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

f = A("f")
i = B("i")
j = C("j")
a = C("a")
e = A("e")
n = C("n")
l = C("l")
m = A("m")

f.q = a
f.v = i
i.w = m
i.x = n
j.w = i
j.p = f
a.w = i
a.p = e
e.q = l
e.v = i
n.w = i
n.p = m
l.w = i
l.p = m
m.q = l
m.v = i
assert i.x.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: B = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
j = C("j")
a = C("a")
e = A("e")
n = C("n")
l = C("l")
m = A("m")

f.q = a
f.v = i
i.w = m
i.x = n
j.w = i
j.p = f
a.w = i
a.p = e
e.q = l
e.v = i
n.w = i
n.p = m
l.w = i
l.p = m
m.q = l
m.v = i
assert i.x.p.v.txt == "i"