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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.s: E = None
        self.x: E = None
        self.o: E = None
        self.r: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.s: E = None
        self.x: E = None
        self.o: E = None
        self.r: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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