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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: E = None
        self.q: B = None
        self.y: G = None
        self.x: C = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.u: A = None
        self.v: A = None
        self.p: A = None
        self.r: E = None
        self.o: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: B = None
        self.y: E = None
        self.p: B = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: E = None
        self.q: B = None
        self.y: G = None
        self.x: C = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.u: A = None
        self.v: A = None
        self.p: A = None
        self.r: E = None
        self.o: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: B = None
        self.y: E = None
        self.p: B = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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