class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.v: A = None
        self.y: E = None
        self.txt = txt

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

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

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

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

h = A("h")
g = B("g")
b = C("b")
f = D("f")
a = E("a")
m = A("m")
e = B("e")

h.t = f
h.u = m
h.v = m
h.y = a
g.u = f
g.v = b
g.r = a
b.v = a
b.r = g
b.u = e
b.p = e
f.o = a
f.r = b
a.t = f
m.t = f
m.u = h
m.v = h
m.y = a
e.u = f
e.v = b
e.r = a
assert h.t.o.t.r.u.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.v: A = None
        self.y: E = None
        self.txt = txt

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

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

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

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

h = A("h")
g = B("g")
b = C("b")
f = D("f")
a = E("a")
m = A("m")
e = B("e")

h.t = f
h.u = m
h.v = m
h.y = a
g.u = f
g.v = b
g.r = a
b.v = a
b.r = g
b.u = e
b.p = e
f.o = a
f.r = b
a.t = f
m.t = f
m.u = h
m.v = h
m.y = a
e.u = f
e.v = b
e.r = a
assert h.t.o.t.r.u.r.t.txt == "f"