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

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

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
c = D("c")
h = E("h")
m = F("m")
k = G("k")
f = D("f")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
c = D("c")
h = E("h")
m = F("m")
k = G("k")
f = D("f")

b.s = k
b.t = h
d.r = c
d.q = j
j.p = b
j.x = b
j.u = h
j.z = m
j.r = f
j.v = c
c.y = f
c.w = b
h.u = k
h.o = k
h.z = f
h.q = j
m.p = h
k.t = j
f.y = c
f.w = b
assert k.t.z.p.z.y.txt == "c"