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

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

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

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

n = A("n")
c = B("c")
j = C("j")
b = D("b")
m = A("m")
e = D("e")

n.z = c
n.v = b
n.x = j
n.o = j
c.w = m
j.y = m
b.t = c
b.r = j
b.y = j
b.w = m
m.z = c
m.v = b
m.x = j
m.o = j
e.t = c
e.r = j
e.y = j
e.w = m
assert m.o.y.o.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: D = None
        self.x: C = None
        self.o: C = None
        self.txt = txt

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

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

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

n = A("n")
c = B("c")
j = C("j")
b = D("b")
m = A("m")
e = D("e")

n.z = c
n.v = b
n.x = j
n.o = j
c.w = m
j.y = m
b.t = c
b.r = j
b.y = j
b.w = m
m.z = c
m.v = b
m.x = j
m.o = j
e.t = c
e.r = j
e.y = j
e.w = m
assert m.o.y.o.y.o.y.txt == "m"