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

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

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

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

j = A("j")
a = B("a")
b = C("b")
m = D("m")
g = C("g")
f = A("f")

j.x = g
j.s = m
j.t = b
j.v = a
a.w = m
a.q = m
a.y = g
a.v = b
b.s = m
b.u = m
b.w = j
m.y = a
m.q = a
g.s = m
g.u = m
g.w = j
f.x = g
f.t = g
f.s = m
f.v = a
assert f.v.w.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: D = None
        self.t: C = None
        self.v: B = None
        self.txt = txt

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

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

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

j = A("j")
a = B("a")
b = C("b")
m = D("m")
g = C("g")
f = A("f")

j.x = g
j.s = m
j.t = b
j.v = a
a.w = m
a.q = m
a.y = g
a.v = b
b.s = m
b.u = m
b.w = j
m.y = a
m.q = a
g.s = m
g.u = m
g.w = j
f.x = g
f.t = g
f.s = m
f.v = a
assert f.v.w.q.y.txt == "g"