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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: A = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: A = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: B = None
        self.txt = txt

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

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