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

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

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

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

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

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

j.x = m
j.p = f
j.t = f
j.s = b
j.r = b
b.u = j
b.p = m
b.s = h
b.r = h
m.t = j
k.s = m
k.y = m
h.s = f
h.p = b
f.s = h
f.p = b
assert m.t.s.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: E = None
        self.s: B = None
        self.t: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

j.x = m
j.p = f
j.t = f
j.s = b
j.r = b
b.u = j
b.p = m
b.s = h
b.r = h
m.t = j
k.s = m
k.y = m
h.s = f
h.p = b
f.s = h
f.p = b
assert m.t.s.u.r.txt == "b"