class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: F = None
        self.y: E = None
        self.s: B = None
        self.x: G = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: C = None
        self.v: F = None
        self.s: F = None
        self.t: F = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

g.t = k
g.w = c
g.y = d
g.s = f
g.x = a
g.p = a
f.w = c
f.v = c
f.s = c
f.t = c
f.x = k
f.o = i
k.r = h
k.q = f
i.x = g
d.y = a
c.z = a
c.t = a
c.y = d
c.p = g
a.p = g
h.x = g
assert a.p.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: F = None
        self.y: E = None
        self.s: B = None
        self.x: G = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: C = None
        self.v: F = None
        self.s: F = None
        self.t: F = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

g.t = k
g.w = c
g.y = d
g.s = f
g.x = a
g.p = a
f.w = c
f.v = c
f.s = c
f.t = c
f.x = k
f.o = i
k.r = h
k.q = f
i.x = g
d.y = a
c.z = a
c.t = a
c.y = d
c.p = g
a.p = g
h.x = g
assert a.p.w.y.txt == "d"