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

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

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

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

k = A("k")
f = B("f")
n = C("n")
l = D("l")
e = A("e")
d = D("d")
i = B("i")
j = B("j")

k.y = n
k.o = n
k.x = d
f.o = k
f.q = i
n.o = e
n.z = l
n.r = d
l.y = n
l.t = d
e.y = n
e.o = n
e.x = d
d.y = n
d.t = l
i.o = e
i.q = j
j.o = e
j.q = f
assert i.o.y.o.x.y.r.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: C = None
        self.x: D = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
n = C("n")
l = D("l")
e = A("e")
d = D("d")
i = B("i")
j = B("j")

k.y = n
k.o = n
k.x = d
f.o = k
f.q = i
n.o = e
n.z = l
n.r = d
l.y = n
l.t = d
e.y = n
e.o = n
e.x = d
d.y = n
d.t = l
i.o = e
i.q = j
j.o = e
j.q = f
assert i.o.y.o.x.y.r.y.o.txt == "e"