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

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

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

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

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

h = A("h")
f = B("f")
j = C("j")
b = D("b")
d = E("d")
n = C("n")

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

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

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

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

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

h = A("h")
f = B("f")
j = C("j")
b = D("b")
d = E("d")
n = C("n")

h.o = d
h.u = n
h.v = n
f.s = b
f.w = b
f.v = b
f.y = n
f.q = d
j.p = f
b.v = h
b.t = h
b.o = f
d.v = b
d.s = h
d.o = h
d.t = f
n.p = f
assert n.p.v.v.o.v.o.txt == "f"