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

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

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

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

i = A("i")
b = B("b")
a = C("a")
h = D("h")
c = C("c")
e = C("e")
d = A("d")
g = C("g")
j = A("j")
m = D("m")

i.p = h
i.y = g
i.z = m
i.s = m
b.u = i
a.x = e
a.q = h
a.r = b
a.v = g
h.r = c
h.s = d
h.o = m
h.x = m
c.x = a
c.v = a
c.q = m
c.r = b
e.x = c
e.q = m
e.r = b
e.v = g
d.p = m
d.z = m
d.y = e
d.s = h
g.x = e
g.q = h
g.r = b
g.v = c
j.p = h
j.z = h
j.s = h
j.y = a
m.r = c
m.s = i
m.o = h
m.x = h
assert j.y.x.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: C = None
        self.z: D = None
        self.s: D = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
a = C("a")
h = D("h")
c = C("c")
e = C("e")
d = A("d")
g = C("g")
j = A("j")
m = D("m")

i.p = h
i.y = g
i.z = m
i.s = m
b.u = i
a.x = e
a.q = h
a.r = b
a.v = g
h.r = c
h.s = d
h.o = m
h.x = m
c.x = a
c.v = a
c.q = m
c.r = b
e.x = c
e.q = m
e.r = b
e.v = g
d.p = m
d.z = m
d.y = e
d.s = h
g.x = e
g.q = h
g.r = b
g.v = c
j.p = h
j.z = h
j.s = h
j.y = a
m.r = c
m.s = i
m.o = h
m.x = h
assert j.y.x.r.u.txt == "i"