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

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: C = None
        self.txt = txt

a = A("a")
k = B("k")
i = C("i")
j = D("j")
n = A("n")
g = D("g")
h = C("h")
f = A("f")
d = B("d")

a.y = n
a.t = f
a.p = h
a.v = d
k.z = n
k.u = h
k.s = h
k.w = g
i.y = h
j.r = g
j.v = h
n.y = f
n.t = f
n.p = i
n.v = k
g.r = j
g.v = i
h.y = i
f.y = n
f.t = a
f.p = i
f.v = d
d.z = n
d.u = h
d.s = h
d.w = j
assert a.y.v.u.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.p: C = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: C = None
        self.txt = txt

a = A("a")
k = B("k")
i = C("i")
j = D("j")
n = A("n")
g = D("g")
h = C("h")
f = A("f")
d = B("d")

a.y = n
a.t = f
a.p = h
a.v = d
k.z = n
k.u = h
k.s = h
k.w = g
i.y = h
j.r = g
j.v = h
n.y = f
n.t = f
n.p = i
n.v = k
g.r = j
g.v = i
h.y = i
f.y = n
f.t = a
f.p = i
f.v = d
d.z = n
d.u = h
d.s = h
d.w = j
assert a.y.v.u.y.y.y.y.y.txt == "i"