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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: D = None
        self.z: A = None
        self.y: A = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: D = None
        self.z: A = None
        self.y: A = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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