class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: G = None
        self.w: D = None
        self.s: D = None
        self.t: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
j = C("j")
m = D("m")
h = E("h")
e = F("e")
g = G("g")
i = D("i")

l.p = h
l.o = g
l.t = g
l.w = m
l.s = m
d.v = j
d.t = h
d.s = h
d.z = l
d.x = e
j.s = h
j.v = e
m.y = j
h.q = l
h.x = d
e.p = d
e.s = l
e.y = g
g.v = j
i.y = j
assert e.s.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: G = None
        self.w: D = None
        self.s: D = None
        self.t: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
j = C("j")
m = D("m")
h = E("h")
e = F("e")
g = G("g")
i = D("i")

l.p = h
l.o = g
l.t = g
l.w = m
l.s = m
d.v = j
d.t = h
d.s = h
d.z = l
d.x = e
j.s = h
j.v = e
m.y = j
h.q = l
h.x = d
e.p = d
e.s = l
e.y = g
g.v = j
i.y = j
assert e.s.p.q.txt == "l"