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

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

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

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

l = A("l")
j = B("j")
m = C("m")
e = D("e")
c = A("c")
a = D("a")

l.o = e
l.u = c
l.p = c
l.x = c
j.t = l
m.u = e
e.y = a
e.u = c
e.r = j
c.o = a
c.u = l
c.p = l
c.x = l
a.y = e
a.u = l
a.r = j
assert e.r.t.x.o.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: A = None
        self.p: A = None
        self.x: A = None
        self.txt = txt

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

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

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

l = A("l")
j = B("j")
m = C("m")
e = D("e")
c = A("c")
a = D("a")

l.o = e
l.u = c
l.p = c
l.x = c
j.t = l
m.u = e
e.y = a
e.u = c
e.r = j
c.o = a
c.u = l
c.p = l
c.x = l
a.y = e
a.u = l
a.r = j
assert e.r.t.x.o.r.t.txt == "l"