class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

g.o = c
g.z = d
g.t = d
m.s = n
m.t = i
b.o = g
b.w = g
b.r = n
b.s = d
i.s = d
i.p = d
i.z = c
i.u = n
i.v = g
d.v = g
j.s = b
j.t = i
n.o = g
n.w = g
n.r = b
n.s = d
c.o = g
c.w = g
c.r = n
c.s = d
assert j.s.r.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

g.o = c
g.z = d
g.t = d
m.s = n
m.t = i
b.o = g
b.w = g
b.r = n
b.s = d
i.s = d
i.p = d
i.z = c
i.u = n
i.v = g
d.v = g
j.s = b
j.t = i
n.o = g
n.w = g
n.r = b
n.s = d
c.o = g
c.w = g
c.r = n
c.s = d
assert j.s.r.s.v.txt == "g"