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

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

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

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

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

e.v = h
m.x = n
b.u = m
j.o = g
j.y = n
j.v = b
n.o = g
n.y = h
n.v = b
g.v = j
h.o = g
h.y = j
h.v = b
assert m.x.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

e.v = h
m.x = n
b.u = m
j.o = g
j.y = n
j.v = b
n.o = g
n.y = h
n.v = b
g.v = j
h.o = g
h.y = j
h.v = b
assert m.x.v.u.txt == "m"