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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: D = None
        self.w: C = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

g.t = m
g.r = m
g.s = m
g.z = m
m.r = g
m.o = g
m.x = i
i.p = d
i.v = g
d.q = g
d.x = i
b.v = m
b.s = d
b.t = d
b.q = d
b.w = i
n.p = d
n.v = g
l.v = m
l.s = d
l.t = d
l.q = d
l.w = i
assert b.w.v.s.r.r.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = None
        self.s: B = None
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: D = None
        self.w: C = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

g.t = m
g.r = m
g.s = m
g.z = m
m.r = g
m.o = g
m.x = i
i.p = d
i.v = g
d.q = g
d.x = i
b.v = m
b.s = d
b.t = d
b.q = d
b.w = i
n.p = d
n.v = g
l.v = m
l.s = d
l.t = d
l.q = d
l.w = i
assert b.w.v.s.r.r.x.p.txt == "d"