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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.y: B = None
        self.v: C = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.q: F = None
        self.x: C = None
        self.txt = txt

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

n = A("n")
h = B("h")
b = C("b")
g = D("g")
j = E("j")
m = F("m")

n.s = j
n.o = j
h.y = n
h.o = j
b.y = j
g.p = n
g.r = n
g.s = m
g.y = h
g.v = b
j.z = g
j.u = h
j.q = m
j.x = b
m.x = j
m.w = j
m.t = j
m.v = h
assert j.u.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.y: B = None
        self.v: C = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.q: F = None
        self.x: C = None
        self.txt = txt

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

n = A("n")
h = B("h")
b = C("b")
g = D("g")
j = E("j")
m = F("m")

n.s = j
n.o = j
h.y = n
h.o = j
b.y = j
g.p = n
g.r = n
g.s = m
g.y = h
g.v = b
j.z = g
j.u = h
j.q = m
j.x = b
m.x = j
m.w = j
m.t = j
m.v = h
assert j.u.o.q.txt == "m"