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

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

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

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

d = A("d")
b = B("b")
g = C("g")
a = D("a")
l = C("l")
h = D("h")
m = A("m")
k = B("k")
n = B("n")

d.u = a
d.x = a
d.q = k
b.w = k
b.o = g
b.y = g
g.v = k
g.r = d
g.q = l
a.y = m
a.w = d
l.v = k
l.r = d
l.q = g
h.y = m
h.w = d
m.u = h
m.q = k
m.x = a
k.w = n
k.o = g
k.y = l
n.w = k
n.o = l
n.y = g
assert m.u.y.q.w.y.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: B = None
        self.x: D = None
        self.txt = txt

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

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

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

d = A("d")
b = B("b")
g = C("g")
a = D("a")
l = C("l")
h = D("h")
m = A("m")
k = B("k")
n = B("n")

d.u = a
d.x = a
d.q = k
b.w = k
b.o = g
b.y = g
g.v = k
g.r = d
g.q = l
a.y = m
a.w = d
l.v = k
l.r = d
l.q = g
h.y = m
h.w = d
m.u = h
m.q = k
m.x = a
k.w = n
k.o = g
k.y = l
n.w = k
n.o = l
n.y = g
assert m.u.y.q.w.y.v.o.txt == "g"