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

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

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

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

a = A("a")
f = B("f")
d = C("d")
e = D("e")
j = D("j")
n = A("n")
k = C("k")
l = A("l")
m = B("m")

a.r = n
a.z = e
a.x = k
f.s = m
d.q = n
d.w = k
d.s = l
d.v = f
e.x = m
e.y = j
e.q = a
j.x = f
j.y = e
j.q = n
n.r = l
n.z = j
n.x = d
k.q = n
k.s = n
k.w = d
k.v = f
l.r = n
l.z = j
l.x = k
m.s = f
assert k.w.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: D = None
        self.x: C = None
        self.txt = txt

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

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

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

a = A("a")
f = B("f")
d = C("d")
e = D("e")
j = D("j")
n = A("n")
k = C("k")
l = A("l")
m = B("m")

a.r = n
a.z = e
a.x = k
f.s = m
d.q = n
d.w = k
d.s = l
d.v = f
e.x = m
e.y = j
e.q = a
j.x = f
j.y = e
j.q = n
n.r = l
n.z = j
n.x = d
k.q = n
k.s = n
k.w = d
k.v = f
l.r = n
l.z = j
l.x = k
m.s = f
assert k.w.q.x.txt == "d"