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

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

class C:
    def __init__(self, txt: str):
        self.q: B = 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.r: C = None
        self.t: G = None
        self.o: F = None
        self.z: B = None
        self.p: C = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.u: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
k = C("k")
c = D("c")
d = E("d")
h = F("h")
l = G("l")
a = C("a")

n.s = k
j.p = a
k.q = j
c.y = k
d.r = a
d.p = a
d.t = l
d.o = h
d.y = h
d.z = j
h.t = j
h.u = j
h.o = c
l.s = j
l.x = n
a.q = j
assert n.s.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = 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.r: C = None
        self.t: G = None
        self.o: F = None
        self.z: B = None
        self.p: C = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.u: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
k = C("k")
c = D("c")
d = E("d")
h = F("h")
l = G("l")
a = C("a")

n.s = k
j.p = a
k.q = j
c.y = k
d.r = a
d.p = a
d.t = l
d.o = h
d.y = h
d.z = j
h.t = j
h.u = j
h.o = c
l.s = j
l.x = n
a.q = j
assert n.s.q.p.q.txt == "j"