class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.z: G = None
        self.q: E = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
k = C("k")
e = D("e")
m = E("m")
h = F("h")
j = G("j")
a = C("a")

f.p = a
f.o = m
f.q = m
f.z = j
f.r = i
i.r = e
k.x = h
e.q = i
m.z = e
m.s = j
m.t = j
m.w = f
m.v = f
m.o = i
h.t = a
h.z = e
h.s = i
j.w = f
j.z = f
j.u = m
j.v = i
a.x = h
assert i.r.q.r.q.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.z: G = None
        self.q: E = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
k = C("k")
e = D("e")
m = E("m")
h = F("h")
j = G("j")
a = C("a")

f.p = a
f.o = m
f.q = m
f.z = j
f.r = i
i.r = e
k.x = h
e.q = i
m.z = e
m.s = j
m.t = j
m.w = f
m.v = f
m.o = i
h.t = a
h.z = e
h.s = i
j.w = f
j.z = f
j.u = m
j.v = i
a.x = h
assert i.r.q.r.q.r.q.r.txt == "e"