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

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

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

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

m = A("m")
c = B("c")
a = C("a")
g = D("g")
i = A("i")
k = A("k")
e = C("e")
d = A("d")
f = B("f")
l = C("l")

m.u = f
m.z = a
m.w = g
c.w = d
c.x = d
c.s = a
a.t = f
a.v = e
a.x = l
g.t = f
g.v = k
i.u = c
i.z = a
i.w = g
k.u = c
k.z = l
k.w = g
e.t = f
e.v = l
e.x = a
d.u = c
d.z = a
d.w = g
f.w = k
f.x = k
f.s = l
l.t = f
l.v = a
l.x = e
assert a.x.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: C = None
        self.w: D = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
a = C("a")
g = D("g")
i = A("i")
k = A("k")
e = C("e")
d = A("d")
f = B("f")
l = C("l")

m.u = f
m.z = a
m.w = g
c.w = d
c.x = d
c.s = a
a.t = f
a.v = e
a.x = l
g.t = f
g.v = k
i.u = c
i.z = a
i.w = g
k.u = c
k.z = l
k.w = g
e.t = f
e.v = l
e.x = a
d.u = c
d.z = a
d.w = g
f.w = k
f.x = k
f.s = l
l.t = f
l.v = a
l.x = e
assert a.x.t.s.txt == "l"