class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: E = None
        self.x: C = None
        self.p: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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