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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
d = D("d")
g = A("g")
l = B("l")
a = C("a")
f = C("f")

b.v = f
b.x = l
b.q = d
b.r = g
m.w = l
m.u = d
i.t = b
i.u = b
i.z = b
i.q = g
d.w = b
g.v = f
g.x = m
g.q = d
g.r = b
l.w = m
l.u = d
a.t = g
a.u = b
a.z = b
a.q = b
f.t = b
f.z = b
f.u = g
f.q = g
assert l.w.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: B = None
        self.q: D = None
        self.r: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
d = D("d")
g = A("g")
l = B("l")
a = C("a")
f = C("f")

b.v = f
b.x = l
b.q = d
b.r = g
m.w = l
m.u = d
i.t = b
i.u = b
i.z = b
i.q = g
d.w = b
g.v = f
g.x = m
g.q = d
g.r = b
l.w = m
l.u = d
a.t = g
a.u = b
a.z = b
a.q = b
f.t = b
f.z = b
f.u = g
f.q = g
assert l.w.w.u.w.txt == "b"