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

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

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

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

i.y = d
i.w = h
l.v = i
n.t = i
n.q = i
d.y = i
d.w = l
c.t = d
c.q = d
k.v = d
f.t = i
f.q = d
h.v = d
assert n.t.w.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.txt = txt

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

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

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

i.y = d
i.w = h
l.v = i
n.t = i
n.q = i
d.y = i
d.w = l
c.t = d
c.q = d
k.v = d
f.t = i
f.q = d
h.v = d
assert n.t.w.v.w.v.txt == "i"