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

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

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

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

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

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

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

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

f.s = b
f.t = i
b.w = a
b.x = a
b.s = l
b.p = k
i.x = a
i.p = a
a.z = b
a.p = b
c.u = a
c.q = l
h.y = c
h.p = c
h.v = k
l.p = b
l.t = b
l.o = c
l.q = f
l.v = f
k.p = b
k.t = b
k.o = c
k.q = f
k.v = f
assert l.q.s.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

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

f.s = b
f.t = i
b.w = a
b.x = a
b.s = l
b.p = k
i.x = a
i.p = a
a.z = b
a.p = b
c.u = a
c.q = l
h.y = c
h.p = c
h.v = k
l.p = b
l.t = b
l.o = c
l.q = f
l.v = f
k.p = b
k.t = b
k.o = c
k.q = f
k.v = f
assert l.q.s.w.p.txt == "b"