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

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

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

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

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

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

g.v = b
g.q = b
g.p = n
g.y = n
h.x = l
m.x = b
m.s = l
m.u = j
d.o = b
b.x = g
n.v = b
n.q = b
n.p = g
n.y = g
l.o = b
i.o = b
j.x = b
j.s = l
j.u = m
f.o = b
assert n.y.v.x.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: E = None
        self.p: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

g.v = b
g.q = b
g.p = n
g.y = n
h.x = l
m.x = b
m.s = l
m.u = j
d.o = b
b.x = g
n.v = b
n.q = b
n.p = g
n.y = g
l.o = b
i.o = b
j.x = b
j.s = l
j.u = m
f.o = b
assert n.y.v.x.p.v.txt == "b"