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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: G = None
        self.q: D = None
        self.w: G = None
        self.p: F = None
        self.y: F = None
        self.txt = txt

f = A("f")
a = B("a")
d = C("d")
j = D("j")
c = E("c")
n = F("n")
m = G("m")
i = G("i")
g = F("g")

f.y = j
a.s = f
a.r = f
d.o = m
j.p = c
j.o = f
c.w = j
c.q = a
c.o = a
c.r = a
n.x = c
m.t = i
m.w = i
m.q = j
m.p = n
m.y = g
i.t = m
i.w = m
i.q = j
i.p = n
i.y = n
g.x = c
assert f.y.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: G = None
        self.q: D = None
        self.w: G = None
        self.p: F = None
        self.y: F = None
        self.txt = txt

f = A("f")
a = B("a")
d = C("d")
j = D("j")
c = E("c")
n = F("n")
m = G("m")
i = G("i")
g = F("g")

f.y = j
a.s = f
a.r = f
d.o = m
j.p = c
j.o = f
c.w = j
c.q = a
c.o = a
c.r = a
n.x = c
m.t = i
m.w = i
m.q = j
m.p = n
m.y = g
i.t = m
i.w = m
i.q = j
i.p = n
i.y = n
g.x = c
assert f.y.p.q.txt == "a"