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

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

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

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

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

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

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

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

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

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

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