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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

m = A("m")
f = B("f")
e = C("e")
d = D("d")
g = D("g")
j = B("j")
l = C("l")

m.w = e
f.w = g
f.r = l
f.v = e
e.t = d
d.p = l
d.u = f
d.x = f
d.s = m
g.p = l
g.u = f
g.x = j
g.s = m
j.w = d
j.r = l
j.v = e
l.t = d
assert m.w.t.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

m = A("m")
f = B("f")
e = C("e")
d = D("d")
g = D("g")
j = B("j")
l = C("l")

m.w = e
f.w = g
f.r = l
f.v = e
e.t = d
d.p = l
d.u = f
d.x = f
d.s = m
g.p = l
g.u = f
g.x = j
g.s = m
j.w = d
j.r = l
j.v = e
l.t = d
assert m.w.t.u.w.x.txt == "j"