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

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

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

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

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

j.z = c
j.t = c
j.r = b
j.s = b
k.t = c
k.o = i
h.x = j
h.y = i
m.z = c
m.w = c
m.y = h
m.p = g
a.z = c
a.y = h
a.p = k
a.w = m
c.z = a
c.w = a
c.y = h
c.p = b
g.t = a
g.o = j
i.z = c
i.t = c
i.r = b
i.s = b
b.t = m
b.o = j
assert i.z.p.t.w.y.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: B = None
        self.t: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

j.z = c
j.t = c
j.r = b
j.s = b
k.t = c
k.o = i
h.x = j
h.y = i
m.z = c
m.w = c
m.y = h
m.p = g
a.z = c
a.y = h
a.p = k
a.w = m
c.z = a
c.w = a
c.y = h
c.p = b
g.t = a
g.o = j
i.z = c
i.t = c
i.r = b
i.s = b
b.t = m
b.o = j
assert i.z.p.t.w.y.x.z.z.txt == "a"