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

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

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

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

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

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

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

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

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

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

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