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

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

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

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

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

k.y = c
e.y = n
e.w = i
e.z = k
n.y = j
a.z = k
a.u = i
j.y = n
j.w = i
j.z = k
f.y = n
f.w = c
f.z = k
c.z = k
c.u = i
i.z = k
i.u = c
assert j.y.y.z.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

k.y = c
e.y = n
e.w = i
e.z = k
n.y = j
a.z = k
a.u = i
j.y = n
j.w = i
j.z = k
f.y = n
f.w = c
f.z = k
c.z = k
c.u = i
i.z = k
i.u = c
assert j.y.y.z.y.u.txt == "i"