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

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

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

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

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

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

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

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

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

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

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