class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

j.r = e
h.s = e
h.v = a
h.z = a
a.v = m
a.p = k
a.z = l
a.s = h
i.q = e
i.x = b
i.z = j
l.s = k
l.v = a
l.z = e
g.q = k
g.x = j
g.z = j
k.v = l
k.s = l
k.p = e
k.z = h
m.s = k
m.v = e
m.z = a
e.v = l
e.p = k
e.z = m
e.s = h
b.r = e
assert g.q.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

j.r = e
h.s = e
h.v = a
h.z = a
a.v = m
a.p = k
a.z = l
a.s = h
i.q = e
i.x = b
i.z = j
l.s = k
l.v = a
l.z = e
g.q = k
g.x = j
g.z = j
k.v = l
k.s = l
k.p = e
k.z = h
m.s = k
m.v = e
m.z = a
e.v = l
e.p = k
e.z = m
e.s = h
b.r = e
assert g.q.s.v.s.txt == "h"