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

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

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

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

j = A("j")
a = B("a")
h = C("h")
l = D("l")
n = C("n")

j.v = a
j.w = a
j.y = l
j.o = l
a.q = l
a.z = h
h.p = j
h.w = l
h.u = l
h.x = a
l.v = j
l.x = j
l.w = h
n.p = j
n.w = l
n.u = l
n.x = a
assert j.y.v.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.o: D = None
        self.w: B = None
        self.txt = txt

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

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

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

j = A("j")
a = B("a")
h = C("h")
l = D("l")
n = C("n")

j.v = a
j.w = a
j.y = l
j.o = l
a.q = l
a.z = h
h.p = j
h.w = l
h.u = l
h.x = a
l.v = j
l.x = j
l.w = h
n.p = j
n.w = l
n.u = l
n.x = a
assert j.y.v.y.w.txt == "h"