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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.z: C = None
        self.t: B = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: F = None
        self.q: A = None
        self.x: B = None
        self.txt = txt

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

d.p = c
d.v = i
d.u = j
j.s = f
i.p = c
m.p = i
m.v = i
m.y = j
m.x = j
m.w = f
m.u = d
c.r = f
l.y = i
l.z = i
l.v = m
l.t = j
l.q = f
f.v = d
f.q = d
f.z = l
f.x = j
assert f.v.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.z: C = None
        self.t: B = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: F = None
        self.q: A = None
        self.x: B = None
        self.txt = txt

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

d.p = c
d.v = i
d.u = j
j.s = f
i.p = c
m.p = i
m.v = i
m.y = j
m.x = j
m.w = f
m.u = d
c.r = f
l.y = i
l.z = i
l.v = m
l.t = j
l.q = f
f.v = d
f.q = d
f.z = l
f.x = j
assert f.v.u.s.txt == "f"