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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: B = None
        self.w: D = None
        self.p: A = None
        self.txt = txt

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

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

g.p = f
g.v = f
f.o = g
i.w = c
c.u = l
c.w = l
c.s = f
c.p = g
n.w = g
n.t = g
n.r = g
n.o = i
n.y = c
l.u = c
l.w = c
l.s = f
l.p = g
m.w = c
assert g.p.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: B = None
        self.w: D = None
        self.p: A = None
        self.txt = txt

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

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

g.p = f
g.v = f
f.o = g
i.w = c
c.u = l
c.w = l
c.s = f
c.p = g
n.w = g
n.t = g
n.r = g
n.o = i
n.y = c
l.u = c
l.w = c
l.s = f
l.p = g
m.w = c
assert g.p.o.v.o.txt == "g"