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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.r: D = None
        self.v: D = None
        self.s: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
b = C("b")
d = D("d")
n = E("n")
i = F("i")
j = G("j")
f = F("f")

a.v = f
a.u = d
a.p = j
a.y = n
h.r = i
b.o = n
b.p = j
b.t = j
b.r = d
b.v = d
b.s = f
d.o = a
n.r = d
i.r = a
i.p = f
j.o = n
j.z = n
j.t = n
j.q = d
f.r = a
f.p = i
assert h.r.r.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.u: D = None
        self.p: G = None
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.r: D = None
        self.v: D = None
        self.s: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
b = C("b")
d = D("d")
n = E("n")
i = F("i")
j = G("j")
f = F("f")

a.v = f
a.u = d
a.p = j
a.y = n
h.r = i
b.o = n
b.p = j
b.t = j
b.r = d
b.v = d
b.s = f
d.o = a
n.r = d
i.r = a
i.p = f
j.o = n
j.z = n
j.t = n
j.q = d
f.r = a
f.p = i
assert h.r.r.u.o.u.txt == "d"