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

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

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

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

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

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

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

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

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

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

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

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

g.v = a
g.o = a
g.r = j
g.p = i
a.x = j
a.y = b
a.r = n
a.u = g
a.p = l
h.t = n
h.w = i
j.s = n
m.v = i
m.o = n
b.v = g
b.o = n
i.v = a
i.o = a
i.r = j
i.p = g
n.t = h
n.w = i
l.v = i
l.o = h
assert j.s.w.r.s.t.txt == "h"