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

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

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

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

n = A("n")
f = B("f")
e = C("e")
a = D("a")
j = C("j")
m = D("m")
l = B("l")
i = C("i")
b = C("b")
h = C("h")

n.v = b
n.q = f
f.r = l
f.w = l
f.t = m
e.u = m
e.v = l
a.r = m
a.y = n
a.o = n
a.x = f
j.u = m
j.v = l
m.r = a
m.y = n
m.o = n
m.x = l
l.r = f
l.w = f
l.t = a
i.u = m
i.v = l
b.u = m
b.v = l
h.u = a
h.v = f
assert n.v.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: B = None
        self.txt = txt

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

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

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

n = A("n")
f = B("f")
e = C("e")
a = D("a")
j = C("j")
m = D("m")
l = B("l")
i = C("i")
b = C("b")
h = C("h")

n.v = b
n.q = f
f.r = l
f.w = l
f.t = m
e.u = m
e.v = l
a.r = m
a.y = n
a.o = n
a.x = f
j.u = m
j.v = l
m.r = a
m.y = n
m.o = n
m.x = l
l.r = f
l.w = f
l.t = a
i.u = m
i.v = l
b.u = m
b.v = l
h.u = a
h.v = f
assert n.v.u.x.txt == "l"