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

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

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

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

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

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

f.v = n
a.u = i
a.s = f
a.x = g
a.p = g
h.y = b
i.u = e
i.y = e
i.t = a
g.r = n
g.v = e
g.t = i
g.p = h
n.u = i
n.s = e
n.x = g
n.p = g
b.y = h
e.v = a
assert h.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

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

f.v = n
a.u = i
a.s = f
a.x = g
a.p = g
h.y = b
i.u = e
i.y = e
i.t = a
g.r = n
g.v = e
g.t = i
g.p = h
n.u = i
n.s = e
n.x = g
n.p = g
b.y = h
e.v = a
assert h.y.y.y.y.txt == "h"