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

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

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

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

i = A("i")
e = B("e")
a = C("a")
c = D("c")
h = C("h")
n = D("n")
f = B("f")
j = A("j")

i.x = n
i.o = e
i.q = c
e.z = n
e.v = f
e.s = f
e.p = i
a.z = h
a.p = n
c.z = a
c.r = a
c.s = a
c.o = h
h.z = a
h.p = n
n.z = a
n.s = a
n.r = h
n.o = h
f.z = c
f.v = e
f.s = e
f.p = j
j.x = n
j.q = n
j.o = e
assert e.p.o.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: B = None
        self.q: D = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
a = C("a")
c = D("c")
h = C("h")
n = D("n")
f = B("f")
j = A("j")

i.x = n
i.o = e
i.q = c
e.z = n
e.v = f
e.s = f
e.p = i
a.z = h
a.p = n
c.z = a
c.r = a
c.s = a
c.o = h
h.z = a
h.p = n
n.z = a
n.s = a
n.r = h
n.o = h
f.z = c
f.v = e
f.s = e
f.p = j
j.x = n
j.q = n
j.o = e
assert e.p.o.p.q.txt == "c"