class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.u: E = None
        self.t: E = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: B = None
        self.r: C = None
        self.txt = txt

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

m = A("m")
k = B("k")
d = C("d")
h = D("h")
l = E("l")
g = C("g")

m.r = g
m.q = h
m.u = l
m.t = l
m.x = k
k.z = h
k.x = h
k.q = l
k.p = m
d.o = h
d.r = h
d.p = l
d.t = g
h.t = k
h.w = k
h.r = g
l.q = m
l.o = d
l.v = k
g.o = h
g.r = h
g.p = l
g.t = d
assert g.t.r.t.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.u: E = None
        self.t: E = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: B = None
        self.r: C = None
        self.txt = txt

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

m = A("m")
k = B("k")
d = C("d")
h = D("h")
l = E("l")
g = C("g")

m.r = g
m.q = h
m.u = l
m.t = l
m.x = k
k.z = h
k.x = h
k.q = l
k.p = m
d.o = h
d.r = h
d.p = l
d.t = g
h.t = k
h.w = k
h.r = g
l.q = m
l.o = d
l.v = k
g.o = h
g.r = h
g.p = l
g.t = d
assert g.t.r.t.z.r.txt == "g"