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

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

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

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

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

f = A("f")
d = B("d")
h = C("h")
c = D("c")
e = E("e")
i = E("i")
g = D("g")

f.w = h
f.v = d
f.r = e
f.u = e
d.r = f
h.p = f
h.w = f
c.q = g
e.v = h
e.s = g
e.z = g
e.p = d
e.y = i
i.v = h
i.s = c
i.z = g
i.p = d
i.y = e
g.q = c
assert i.p.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: B = None
        self.r: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

f = A("f")
d = B("d")
h = C("h")
c = D("c")
e = E("e")
i = E("i")
g = D("g")

f.w = h
f.v = d
f.r = e
f.u = e
d.r = f
h.p = f
h.w = f
c.q = g
e.v = h
e.s = g
e.z = g
e.p = d
e.y = i
i.v = h
i.s = c
i.z = g
i.p = d
i.y = e
g.q = c
assert i.p.r.v.txt == "d"