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

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

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

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

m = A("m")
f = B("f")
g = C("g")
k = D("k")
b = C("b")
c = D("c")
e = B("e")

m.s = b
m.v = b
m.z = e
f.v = c
f.r = m
f.t = m
f.u = e
g.x = m
g.o = b
g.q = e
g.z = f
k.s = m
k.y = m
b.x = m
b.o = g
b.q = f
b.z = e
c.s = m
c.y = m
e.v = k
e.r = m
e.t = m
e.u = f
assert g.x.z.v.y.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: B = None
        self.v: C = None
        self.txt = txt

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

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

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

m = A("m")
f = B("f")
g = C("g")
k = D("k")
b = C("b")
c = D("c")
e = B("e")

m.s = b
m.v = b
m.z = e
f.v = c
f.r = m
f.t = m
f.u = e
g.x = m
g.o = b
g.q = e
g.z = f
k.s = m
k.y = m
b.x = m
b.o = g
b.q = f
b.z = e
c.s = m
c.y = m
e.v = k
e.r = m
e.t = m
e.u = f
assert g.x.z.v.y.v.x.txt == "m"