class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: D = None
        self.q: D = None
        self.r: C = None
        self.z: C = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: F = None
        self.o: A = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.q: A = 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.t: A = None
        self.x: C = None
        self.r: F = None
        self.o: C = None
        self.y: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: F = None
        self.o: A = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.q: A = 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.t: A = None
        self.x: C = None
        self.r: F = None
        self.o: C = None
        self.y: C = None
        self.txt = txt

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

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