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

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

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

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

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

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

b.r = e
b.u = k
b.v = i
f.y = g
f.z = e
f.p = b
f.u = i
h.v = e
e.p = i
i.p = k
k.v = e
g.y = f
g.z = e
g.p = b
g.u = i
assert b.v.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

b.r = e
b.u = k
b.v = i
f.y = g
f.z = e
f.p = b
f.u = i
h.v = e
e.p = i
i.p = k
k.v = e
g.y = f
g.z = e
g.p = b
g.u = i
assert b.v.p.v.txt == "e"