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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.t: E = None
        self.z: D = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
c = C("c")
i = D("i")
f = E("f")
h = D("h")

g.u = i
j.v = c
j.p = g
j.t = f
j.z = i
c.p = f
c.q = h
c.y = i
i.r = j
i.y = f
i.v = f
f.t = j
f.u = j
f.v = h
h.r = j
h.y = f
h.v = f
assert h.v.v.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.t: E = None
        self.z: D = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
c = C("c")
i = D("i")
f = E("f")
h = D("h")

g.u = i
j.v = c
j.p = g
j.t = f
j.z = i
c.p = f
c.q = h
c.y = i
i.r = j
i.y = f
i.v = f
f.t = j
f.u = j
f.v = h
h.r = j
h.y = f
h.v = f
assert h.v.v.v.t.v.txt == "c"