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

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

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

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

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

g = A("g")
i = B("i")
f = C("f")
j = D("j")
h = E("h")
b = A("b")

g.r = f
g.v = f
g.o = b
g.t = b
i.u = f
i.t = j
f.r = h
f.s = i
j.r = i
j.u = i
h.q = f
h.v = j
h.p = j
h.u = i
h.y = g
b.r = f
b.v = f
b.o = g
b.t = g
assert b.o.r.s.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: A = None
        self.v: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

g = A("g")
i = B("i")
f = C("f")
j = D("j")
h = E("h")
b = A("b")

g.r = f
g.v = f
g.o = b
g.t = b
i.u = f
i.t = j
f.r = h
f.s = i
j.r = i
j.u = i
h.q = f
h.v = j
h.p = j
h.u = i
h.y = g
b.r = f
b.v = f
b.o = g
b.t = g
assert b.o.r.s.u.r.txt == "h"