class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.t: D = None
        self.txt = txt

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

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

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

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

g = A("g")
l = B("l")
a = C("a")
d = D("d")
k = E("k")
h = C("h")
j = D("j")

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

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

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

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

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

g = A("g")
l = B("l")
a = C("a")
d = D("d")
k = E("k")
h = C("h")
j = D("j")

g.q = k
g.z = j
g.t = j
l.v = a
l.z = h
l.o = k
a.s = d
a.z = k
a.u = j
a.q = h
d.x = j
d.p = h
k.w = h
k.q = g
h.s = j
h.z = k
h.u = d
h.q = a
j.x = d
j.p = h
assert g.t.p.s.txt == "j"