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

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

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

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

m = A("m")
a = B("a")
g = C("g")
j = D("j")
b = B("b")
f = A("f")
h = D("h")
e = A("e")
d = D("d")
k = B("k")

m.s = f
m.y = f
m.z = g
m.v = e
a.o = m
a.t = k
g.s = d
j.o = e
j.v = g
b.o = f
b.t = k
f.s = e
f.v = e
f.z = g
f.y = m
h.o = m
h.v = g
e.s = f
e.z = g
e.v = m
e.y = m
d.o = e
d.v = g
k.o = f
k.t = a
assert e.s.z.s.o.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

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

m = A("m")
a = B("a")
g = C("g")
j = D("j")
b = B("b")
f = A("f")
h = D("h")
e = A("e")
d = D("d")
k = B("k")

m.s = f
m.y = f
m.z = g
m.v = e
a.o = m
a.t = k
g.s = d
j.o = e
j.v = g
b.o = f
b.t = k
f.s = e
f.v = e
f.z = g
f.y = m
h.o = m
h.v = g
e.s = f
e.z = g
e.v = m
e.y = m
d.o = e
d.v = g
k.o = f
k.t = a
assert e.s.z.s.o.s.z.s.txt == "d"