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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

b = A("b")
a = B("a")
l = C("l")
d = D("d")
f = E("f")
h = E("h")
k = C("k")

b.y = a
b.t = f
b.x = h
a.x = b
a.q = b
a.y = d
a.r = d
a.w = k
l.z = h
l.t = f
l.p = d
d.s = b
d.x = b
d.t = a
f.r = k
f.s = a
f.o = b
f.y = h
f.p = d
h.r = k
h.s = a
h.o = b
h.y = f
h.p = d
k.z = f
k.t = h
k.p = d
assert b.t.r.p.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: E = None
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

b = A("b")
a = B("a")
l = C("l")
d = D("d")
f = E("f")
h = E("h")
k = C("k")

b.y = a
b.t = f
b.x = h
a.x = b
a.q = b
a.y = d
a.r = d
a.w = k
l.z = h
l.t = f
l.p = d
d.s = b
d.x = b
d.t = a
f.r = k
f.s = a
f.o = b
f.y = h
f.p = d
h.r = k
h.s = a
h.o = b
h.y = f
h.p = d
k.z = f
k.t = h
k.p = d
assert b.t.r.p.t.x.txt == "b"