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

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: E = None
        self.y: C = None
        self.q: E = None
        self.p: B = None
        self.txt = txt

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

f = A("f")
d = B("d")
a = C("a")
i = D("i")
h = E("h")
c = C("c")

f.o = d
f.v = h
d.p = h
d.v = h
d.x = i
d.r = i
d.y = i
a.o = d
a.s = c
i.z = d
i.p = d
i.x = h
i.q = h
i.y = c
h.u = d
c.o = d
c.s = a
assert h.u.y.y.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: E = None
        self.y: C = None
        self.q: E = None
        self.p: B = None
        self.txt = txt

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

f = A("f")
d = B("d")
a = C("a")
i = D("i")
h = E("h")
c = C("c")

f.o = d
f.v = h
d.p = h
d.v = h
d.x = i
d.r = i
d.y = i
a.o = d
a.s = c
i.z = d
i.p = d
i.x = h
i.q = h
i.y = c
h.u = d
c.o = d
c.s = a
assert h.u.y.y.o.r.txt == "i"