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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: D = None
        self.p: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.z: A = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

h = A("h")
k = B("k")
l = C("l")
c = D("c")
b = E("b")
g = C("g")
j = D("j")

h.r = k
h.t = k
h.z = j
k.z = j
l.v = h
c.y = j
c.v = j
c.p = l
c.x = h
b.y = g
b.t = g
b.w = g
b.z = h
b.r = k
g.v = h
j.y = c
j.v = c
j.p = g
j.x = h
assert l.v.t.z.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: B = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: D = None
        self.p: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.z: A = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

h = A("h")
k = B("k")
l = C("l")
c = D("c")
b = E("b")
g = C("g")
j = D("j")

h.r = k
h.t = k
h.z = j
k.z = j
l.v = h
c.y = j
c.v = j
c.p = l
c.x = h
b.y = g
b.t = g
b.w = g
b.z = h
b.r = k
g.v = h
j.y = c
j.v = c
j.p = g
j.x = h
assert l.v.t.z.x.t.txt == "k"