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

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

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

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

l = A("l")
e = B("e")
f = C("f")
j = D("j")
k = B("k")
g = D("g")
h = C("h")
a = D("a")

l.v = a
e.x = l
e.z = g
e.p = h
e.q = h
f.u = h
j.x = e
j.q = l
j.s = g
k.x = l
k.z = a
k.p = h
k.q = f
g.x = e
g.q = l
g.s = j
h.u = f
a.x = e
a.q = l
a.s = g
assert e.z.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

l = A("l")
e = B("e")
f = C("f")
j = D("j")
k = B("k")
g = D("g")
h = C("h")
a = D("a")

l.v = a
e.x = l
e.z = g
e.p = h
e.q = h
f.u = h
j.x = e
j.q = l
j.s = g
k.x = l
k.z = a
k.p = h
k.q = f
g.x = e
g.q = l
g.s = j
h.u = f
a.x = e
a.q = l
a.s = g
assert e.z.q.v.txt == "a"