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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

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

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

g.t = c
k.s = c
k.p = l
k.u = l
k.v = h
c.q = h
c.t = k
h.p = c
h.v = g
h.s = g
h.t = g
l.u = g
l.p = h
assert c.q.t.t.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

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

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

g.t = c
k.s = c
k.p = l
k.u = l
k.v = h
c.q = h
c.t = k
h.p = c
h.v = g
h.s = g
h.t = g
l.u = g
l.p = h
assert c.q.t.t.t.v.txt == "h"