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

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

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

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

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

f = A("f")
e = B("e")
b = C("b")
l = D("l")
c = E("c")
g = E("g")
d = B("d")

f.x = l
f.u = g
e.u = c
e.w = c
e.t = f
e.o = f
e.s = d
b.s = c
b.o = f
l.u = g
c.v = l
c.r = g
g.v = l
g.r = c
d.u = g
d.w = c
d.t = f
d.o = f
d.s = e
assert b.s.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: E = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
b = C("b")
l = D("l")
c = E("c")
g = E("g")
d = B("d")

f.x = l
f.u = g
e.u = c
e.w = c
e.t = f
e.o = f
e.s = d
b.s = c
b.o = f
l.u = g
c.v = l
c.r = g
g.v = l
g.r = c
d.u = g
d.w = c
d.t = f
d.o = f
d.s = e
assert b.s.r.r.r.txt == "g"