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

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

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

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

j = A("j")
i = B("i")
m = C("m")
h = D("h")
a = C("a")
d = C("d")

j.v = h
j.w = i
j.y = a
i.v = d
i.y = j
i.z = j
i.q = j
m.v = h
m.x = j
m.p = j
h.r = j
h.o = d
h.x = m
a.v = h
a.x = j
a.p = j
d.v = h
d.x = j
d.p = j
assert i.y.v.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: B = None
        self.y: C = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
m = C("m")
h = D("h")
a = C("a")
d = C("d")

j.v = h
j.w = i
j.y = a
i.v = d
i.y = j
i.z = j
i.q = j
m.v = h
m.x = j
m.p = j
h.r = j
h.o = d
h.x = m
a.v = h
a.x = j
a.p = j
d.v = h
d.x = j
d.p = j
assert i.y.v.r.y.txt == "a"