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

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

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

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

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

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

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

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

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

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

j.q = l
j.v = e
j.w = g
j.s = f
d.o = e
d.y = e
e.z = g
e.x = m
e.r = h
l.t = f
l.r = e
l.u = m
l.s = g
m.o = e
m.y = e
h.t = j
h.r = e
h.u = m
h.s = l
g.t = f
g.r = e
g.u = m
g.s = h
f.q = h
f.v = e
f.w = g
f.s = j
assert g.t.q.s.t.q.u.o.txt == "e"