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

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

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

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

e = A("e")
a = B("a")
l = C("l")
k = D("k")
b = B("b")
i = B("i")

e.u = k
e.y = i
a.p = e
a.y = e
a.u = i
l.y = k
l.x = e
k.r = b
k.z = l
k.x = l
b.p = e
b.y = e
b.u = i
i.p = e
i.y = e
i.u = a
assert e.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.txt = txt

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

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

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

e = A("e")
a = B("a")
l = C("l")
k = D("k")
b = B("b")
i = B("i")

e.u = k
e.y = i
a.p = e
a.y = e
a.u = i
l.y = k
l.x = e
k.r = b
k.z = l
k.x = l
b.p = e
b.y = e
b.u = i
i.p = e
i.y = e
i.u = a
assert e.y.y.y.txt == "i"