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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.t: D = None
        self.x: D = None
        self.r: A = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
b = C("b")
g = D("g")
c = E("c")
d = D("d")

a.v = d
h.v = g
h.x = g
h.y = c
h.r = c
h.s = b
b.u = c
b.y = c
b.t = d
b.x = d
b.r = a
g.q = d
g.z = c
g.p = c
c.s = h
c.p = h
c.x = g
c.r = a
c.u = d
d.q = g
d.z = c
d.p = c
assert b.t.p.p.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.t: D = None
        self.x: D = None
        self.r: A = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
b = C("b")
g = D("g")
c = E("c")
d = D("d")

a.v = d
h.v = g
h.x = g
h.y = c
h.r = c
h.s = b
b.u = c
b.y = c
b.t = d
b.x = d
b.r = a
g.q = d
g.z = c
g.p = c
c.s = h
c.p = h
c.x = g
c.r = a
c.u = d
d.q = g
d.z = c
d.p = c
assert b.t.p.p.y.r.v.txt == "d"