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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: B = None
        self.z: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: C = None
        self.y: C = None
        self.t: D = None
        self.txt = txt

a = A("a")
g = B("g")
m = C("m")
k = D("k")
h = E("h")
i = E("i")
b = C("b")
n = B("n")
l = D("l")
d = B("d")

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: B = None
        self.z: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: C = None
        self.y: C = None
        self.t: D = None
        self.txt = txt

a = A("a")
g = B("g")
m = C("m")
k = D("k")
h = E("h")
i = E("i")
b = C("b")
n = B("n")
l = D("l")
d = B("d")

a.z = g
a.t = k
g.u = b
g.o = a
g.p = a
g.t = a
g.q = n
m.p = g
m.u = n
m.z = a
m.y = i
k.q = i
k.y = i
k.t = d
h.r = i
h.x = m
h.y = b
h.t = k
i.r = h
i.x = b
i.y = b
i.t = k
b.p = g
b.u = d
b.z = a
b.y = h
n.u = m
n.o = a
n.p = a
n.t = a
n.q = g
l.q = h
l.y = h
l.t = n
d.u = m
d.o = a
d.p = a
d.t = a
d.q = n
assert g.u.p.u.txt == "b"