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

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

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

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

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

f = A("f")
b = B("b")
m = C("m")
l = D("l")
h = E("h")

f.t = h
f.q = h
f.p = b
f.z = m
f.v = l
b.y = m
b.z = h
b.s = h
b.t = h
b.p = l
m.x = l
m.r = l
l.r = b
l.y = f
h.t = f
assert b.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: B = None
        self.z: C = None
        self.v: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

f = A("f")
b = B("b")
m = C("m")
l = D("l")
h = E("h")

f.t = h
f.q = h
f.p = b
f.z = m
f.v = l
b.y = m
b.z = h
b.s = h
b.t = h
b.p = l
m.x = l
m.r = l
l.r = b
l.y = f
h.t = f
assert b.p.y.p.txt == "b"