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

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

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

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

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

d = A("d")
g = B("g")
n = C("n")
h = D("h")
c = E("c")
a = D("a")

d.t = c
d.y = n
g.o = a
g.v = c
n.x = h
n.u = h
n.r = d
h.x = n
h.y = n
h.q = d
h.t = d
h.r = g
c.o = h
a.x = n
a.y = n
a.q = d
a.t = d
a.r = g
assert a.r.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.txt = txt

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

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

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

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

d = A("d")
g = B("g")
n = C("n")
h = D("h")
c = E("c")
a = D("a")

d.t = c
d.y = n
g.o = a
g.v = c
n.x = h
n.u = h
n.r = d
h.x = n
h.y = n
h.q = d
h.t = d
h.r = g
c.o = h
a.x = n
a.y = n
a.q = d
a.t = d
a.r = g
assert a.r.o.r.o.txt == "a"