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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.v: B = None
        self.q: B = None
        self.txt = txt

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

n = A("n")
b = B("b")
h = C("h")
e = D("e")
g = E("g")

n.x = e
n.p = g
n.s = g
n.y = b
b.p = h
b.t = h
b.v = h
b.u = n
h.w = g
h.v = n
e.y = b
e.u = b
e.v = b
e.q = b
g.x = b
g.y = e
assert g.x.p.v.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.y: B = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.v: B = None
        self.q: B = None
        self.txt = txt

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

n = A("n")
b = B("b")
h = C("h")
e = D("e")
g = E("g")

n.x = e
n.p = g
n.s = g
n.y = b
b.p = h
b.t = h
b.v = h
b.u = n
h.w = g
h.v = n
e.y = b
e.u = b
e.v = b
e.q = b
g.x = b
g.y = e
assert g.x.p.v.x.u.txt == "b"