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

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.o: C = None
        self.txt = txt

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

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

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

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

f.s = b
f.x = b
h.v = b
h.s = b
h.t = b
h.r = k
l.v = f
l.t = h
l.o = b
l.r = b
l.s = c
b.r = k
b.o = l
c.o = h
c.q = b
k.r = l
d.p = c
assert d.p.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.o: C = None
        self.txt = txt

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

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

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

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

f.s = b
f.x = b
h.v = b
h.s = b
h.t = b
h.r = k
l.v = f
l.t = h
l.o = b
l.r = b
l.s = c
b.r = k
b.o = l
c.o = h
c.q = b
k.r = l
d.p = c
assert d.p.o.r.txt == "k"