class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: G = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.txt = txt

j = A("j")
l = B("l")
b = C("b")
a = D("a")
h = E("h")
g = F("g")
c = G("c")

j.p = l
j.u = l
j.q = l
j.o = c
l.z = j
b.q = j
b.u = l
b.p = a
a.v = h
h.p = b
h.w = l
h.u = l
h.v = a
h.s = a
h.o = c
h.t = g
g.p = a
g.y = c
c.w = g
c.x = l
assert l.z.u.z.u.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: G = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.txt = txt

j = A("j")
l = B("l")
b = C("b")
a = D("a")
h = E("h")
g = F("g")
c = G("c")

j.p = l
j.u = l
j.q = l
j.o = c
l.z = j
b.q = j
b.u = l
b.p = a
a.v = h
h.p = b
h.w = l
h.u = l
h.v = a
h.s = a
h.o = c
h.t = g
g.p = a
g.y = c
c.w = g
c.x = l
assert l.z.u.z.u.z.q.txt == "l"