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

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

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

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

f = A("f")
l = B("l")
n = C("n")
k = D("k")
g = D("g")
i = A("i")
c = C("c")

f.p = g
f.s = l
f.q = k
f.z = i
l.u = k
l.z = g
n.z = g
n.t = i
n.y = i
n.u = k
k.s = i
k.o = i
k.p = n
k.t = g
g.s = f
g.p = n
g.t = k
g.o = i
i.p = g
i.q = g
i.s = l
i.z = f
c.z = k
c.t = f
c.y = f
c.u = g
assert c.z.t.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
n = C("n")
k = D("k")
g = D("g")
i = A("i")
c = C("c")

f.p = g
f.s = l
f.q = k
f.z = i
l.u = k
l.z = g
n.z = g
n.t = i
n.y = i
n.u = k
k.s = i
k.o = i
k.p = n
k.t = g
g.s = f
g.p = n
g.t = k
g.o = i
i.p = g
i.q = g
i.s = l
i.z = f
c.z = k
c.t = f
c.y = f
c.u = g
assert c.z.t.o.p.txt == "g"