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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.w: A = None
        self.txt = txt

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

b.q = i
b.z = l
c.z = b
c.s = b
c.o = i
c.r = i
c.q = h
h.u = c
h.r = n
h.o = b
m.p = c
m.z = l
m.q = h
m.x = h
m.o = b
n.t = f
n.v = b
n.w = b
l.u = f
l.r = n
l.o = b
f.z = b
f.s = b
f.o = i
f.q = l
f.r = m
i.p = f
i.z = l
i.x = l
i.q = h
i.o = b
assert f.o.q.r.t.o.txt == "i"