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

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

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

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

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

i.p = a
i.z = j
a.o = h
a.t = j
a.q = j
a.x = c
j.t = a
h.z = i
h.r = c
h.p = c
h.t = j
m.z = e
m.r = i
m.p = i
m.t = j
c.p = a
c.z = j
e.p = a
e.z = j
k.z = e
k.r = e
k.p = e
k.t = j
assert i.p.x.z.t.o.z.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

i.p = a
i.z = j
a.o = h
a.t = j
a.q = j
a.x = c
j.t = a
h.z = i
h.r = c
h.p = c
h.t = j
m.z = e
m.r = i
m.p = i
m.t = j
c.p = a
c.z = j
e.p = a
e.z = j
k.z = e
k.r = e
k.p = e
k.t = j
assert i.p.x.z.t.o.z.p.o.txt == "h"