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

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

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

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

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

l.u = d
l.s = d
l.x = i
l.w = a
b.z = i
b.q = i
b.r = k
i.p = l
i.u = c
a.w = k
a.x = i
c.w = k
c.x = i
k.z = i
k.q = i
k.r = b
d.u = l
d.s = l
d.x = i
d.w = c
assert d.x.p.x.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.x: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

l.u = d
l.s = d
l.x = i
l.w = a
b.z = i
b.q = i
b.r = k
i.p = l
i.u = c
a.w = k
a.x = i
c.w = k
c.x = i
k.z = i
k.q = i
k.r = b
d.u = l
d.s = l
d.x = i
d.w = c
assert d.x.p.x.u.w.txt == "k"