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

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

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

i = A("i")
a = B("a")
k = C("k")
f = C("f")
m = B("m")
e = B("e")
c = A("c")
d = A("d")
b = A("b")
j = B("j")

i.y = m
i.x = f
i.v = e
a.w = k
a.z = k
k.t = f
k.p = m
f.t = k
f.p = m
m.w = k
m.z = f
e.w = f
e.z = f
c.y = e
c.x = k
c.v = a
d.y = a
d.x = f
d.v = j
b.y = e
b.x = k
b.v = m
j.w = k
j.z = k
assert e.w.t.t.p.z.t.p.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

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

i = A("i")
a = B("a")
k = C("k")
f = C("f")
m = B("m")
e = B("e")
c = A("c")
d = A("d")
b = A("b")
j = B("j")

i.y = m
i.x = f
i.v = e
a.w = k
a.z = k
k.t = f
k.p = m
f.t = k
f.p = m
m.w = k
m.z = f
e.w = f
e.z = f
c.y = e
c.x = k
c.v = a
d.y = a
d.x = f
d.v = j
b.y = e
b.x = k
b.v = m
j.w = k
j.z = k
assert e.w.t.t.p.z.t.p.z.t.txt == "k"