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

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

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

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

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

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

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

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

l.w = d
l.t = f
l.y = m
n.p = d
d.q = m
f.z = i
f.y = l
f.q = d
c.s = n
c.t = n
b.x = m
m.p = f
m.x = l
i.x = m
g.z = i
g.y = l
g.q = d
assert l.y.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: D = None
        self.y: G = None
        self.txt = txt

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

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

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

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

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

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

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

l.w = d
l.t = f
l.y = m
n.p = d
d.q = m
f.z = i
f.y = l
f.q = d
c.s = n
c.t = n
b.x = m
m.p = f
m.x = l
i.x = m
g.z = i
g.y = l
g.q = d
assert l.y.x.t.txt == "f"