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

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

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

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

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

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

f.v = i
l.o = f
l.u = f
l.t = b
g.v = a
g.r = a
g.o = e
b.v = a
b.w = i
a.o = l
a.p = f
i.v = f
c.v = a
c.r = a
c.o = e
e.v = a
e.r = a
e.o = g
assert b.v.p.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

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

f.v = i
l.o = f
l.u = f
l.t = b
g.v = a
g.r = a
g.o = e
b.v = a
b.w = i
a.o = l
a.p = f
i.v = f
c.v = a
c.r = a
c.o = e
e.v = a
e.r = a
e.o = g
assert b.v.p.v.v.v.v.v.v.txt == "f"