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

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

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

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

b = A("b")
i = B("i")
k = C("k")
m = D("m")
e = D("e")
j = A("j")
c = B("c")
a = B("a")

b.p = j
b.s = e
b.u = k
i.v = a
i.x = j
i.u = m
k.z = m
m.y = b
m.s = j
e.y = j
e.s = b
j.p = b
j.s = m
j.u = k
c.v = a
c.x = b
c.u = m
a.v = c
a.x = j
a.u = e
assert e.s.u.z.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: D = None
        self.u: C = None
        self.txt = txt

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

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

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

b = A("b")
i = B("i")
k = C("k")
m = D("m")
e = D("e")
j = A("j")
c = B("c")
a = B("a")

b.p = j
b.s = e
b.u = k
i.v = a
i.x = j
i.u = m
k.z = m
m.y = b
m.s = j
e.y = j
e.s = b
j.p = b
j.s = m
j.u = k
c.v = a
c.x = b
c.u = m
a.v = c
a.x = j
a.u = e
assert e.s.u.z.y.p.txt == "j"