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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

c.w = f
c.q = f
f.w = n
f.y = b
f.p = d
f.q = i
f.v = c
e.y = l
e.x = c
e.q = b
d.y = f
d.x = e
b.u = e
l.o = f
l.p = c
i.y = d
i.p = l
n.y = d
n.p = l
h.u = e
assert l.p.w.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

c.w = f
c.q = f
f.w = n
f.y = b
f.p = d
f.q = i
f.v = c
e.y = l
e.x = c
e.q = b
d.y = f
d.x = e
b.u = e
l.o = f
l.p = c
i.y = d
i.p = l
n.y = d
n.p = l
h.u = e
assert l.p.w.v.q.txt == "f"