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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: E = None
        self.s: A = None
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: B = None
        self.q: F = None
        self.v: B = None
        self.txt = txt

a = A("a")
c = B("c")
l = C("l")
g = D("g")
n = E("n")
j = F("j")
e = C("e")
i = F("i")

a.p = e
a.y = g
c.z = a
c.w = n
c.v = l
l.z = g
l.w = c
l.r = n
g.q = a
g.s = a
g.v = a
g.x = a
g.p = n
n.p = a
n.w = a
n.s = g
n.t = c
j.p = i
j.q = i
j.x = c
j.v = c
e.z = g
e.w = c
e.r = n
i.p = j
i.q = j
i.x = c
i.v = c
assert g.s.y.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: E = None
        self.s: A = None
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: B = None
        self.q: F = None
        self.v: B = None
        self.txt = txt

a = A("a")
c = B("c")
l = C("l")
g = D("g")
n = E("n")
j = F("j")
e = C("e")
i = F("i")

a.p = e
a.y = g
c.z = a
c.w = n
c.v = l
l.z = g
l.w = c
l.r = n
g.q = a
g.s = a
g.v = a
g.x = a
g.p = n
n.p = a
n.w = a
n.s = g
n.t = c
j.p = i
j.q = i
j.x = c
j.v = c
e.z = g
e.w = c
e.r = n
i.p = j
i.q = j
i.x = c
i.v = c
assert g.s.y.x.p.txt == "e"