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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: A = None
        self.x: D = None
        self.s: C = None
        self.t: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
h = C("h")
l = D("l")
g = E("g")
f = B("f")

e.p = h
e.v = g
j.v = l
j.x = l
j.w = e
j.s = h
j.t = f
h.q = e
h.u = e
h.t = e
h.p = f
h.x = g
l.y = h
l.z = g
g.y = e
f.v = l
f.x = l
f.w = e
f.s = h
f.t = j
assert f.x.z.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: A = None
        self.x: D = None
        self.s: C = None
        self.t: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
h = C("h")
l = D("l")
g = E("g")
f = B("f")

e.p = h
e.v = g
j.v = l
j.x = l
j.w = e
j.s = h
j.t = f
h.q = e
h.u = e
h.t = e
h.p = f
h.x = g
l.y = h
l.z = g
g.y = e
f.v = l
f.x = l
f.w = e
f.s = h
f.t = j
assert f.x.z.y.v.txt == "g"