class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: D = None
        self.o: D = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: D = None
        self.o: D = None
        self.v: E = None
        self.txt = txt

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

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

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