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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

f = A("f")
d = B("d")
j = C("j")
c = D("c")
h = E("h")

f.o = d
f.v = d
d.u = j
j.q = c
j.p = c
j.u = h
j.x = f
j.y = d
c.q = f
c.t = f
c.s = d
c.u = h
h.y = c
h.t = j
h.p = j
assert c.s.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

f = A("f")
d = B("d")
j = C("j")
c = D("c")
h = E("h")

f.o = d
f.v = d
d.u = j
j.q = c
j.p = c
j.u = h
j.x = f
j.y = d
c.q = f
c.t = f
c.s = d
c.u = h
h.y = c
h.t = j
h.p = j
assert c.s.u.y.txt == "d"