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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: D = None
        self.txt = txt

n = A("n")
j = B("j")
e = C("e")
h = D("h")
c = E("c")
b = A("b")
d = D("d")
f = D("f")
g = E("g")

n.y = e
n.o = g
n.q = h
j.v = g
j.w = f
e.q = f
e.y = c
h.x = n
c.y = j
c.o = h
b.y = e
b.o = c
b.q = h
d.x = n
f.x = b
g.y = j
g.o = h
assert h.x.o.y.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: D = None
        self.txt = txt

n = A("n")
j = B("j")
e = C("e")
h = D("h")
c = E("c")
b = A("b")
d = D("d")
f = D("f")
g = E("g")

n.y = e
n.o = g
n.q = h
j.v = g
j.w = f
e.q = f
e.y = c
h.x = n
c.y = j
c.o = h
b.y = e
b.o = c
b.q = h
d.x = n
f.x = b
g.y = j
g.o = h
assert h.x.o.y.w.x.y.txt == "e"