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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: D = None
        self.w: D = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.q: D = None
        self.s: C = None
        self.txt = txt

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

c = A("c")
j = B("j")
a = C("a")
d = D("d")
b = C("b")
e = B("e")
f = C("f")
g = A("g")

c.w = j
c.y = j
c.x = b
c.z = d
j.o = b
j.q = d
j.w = d
j.t = c
a.r = e
a.o = f
a.q = d
a.s = b
d.y = g
d.s = a
b.r = j
b.o = f
b.q = d
b.s = a
e.o = a
e.q = d
e.w = d
e.t = c
f.r = e
f.o = a
f.q = d
f.s = b
g.w = e
g.y = e
g.x = b
g.z = d
assert j.t.x.r.t.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.y: B = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: D = None
        self.w: D = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.q: D = None
        self.s: C = None
        self.txt = txt

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

c = A("c")
j = B("j")
a = C("a")
d = D("d")
b = C("b")
e = B("e")
f = C("f")
g = A("g")

c.w = j
c.y = j
c.x = b
c.z = d
j.o = b
j.q = d
j.w = d
j.t = c
a.r = e
a.o = f
a.q = d
a.s = b
d.y = g
d.s = a
b.r = j
b.o = f
b.q = d
b.s = a
e.o = a
e.q = d
e.w = d
e.t = c
f.r = e
f.o = a
f.q = d
f.s = b
g.w = e
g.y = e
g.x = b
g.z = d
assert j.t.x.r.t.x.s.txt == "a"