class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
b = C("b")
h = D("h")
c = E("c")
g = A("g")

d.o = c
d.r = c
d.q = k
k.o = b
k.s = g
k.y = g
k.p = g
b.v = h
b.z = h
b.p = g
h.r = c
h.z = b
c.s = d
c.z = g
g.o = c
g.r = c
g.q = k
assert d.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
b = C("b")
h = D("h")
c = E("c")
g = A("g")

d.o = c
d.r = c
d.q = k
k.o = b
k.s = g
k.y = g
k.p = g
b.v = h
b.z = h
b.p = g
h.r = c
h.z = b
c.s = d
c.z = g
g.o = c
g.r = c
g.q = k
assert d.r.s.r.txt == "c"